Convert SteamID32, ID, Steam Name to Steam64
STEAMID API
The Dota2 API generally gives you people's SteamIDs as 32-bit numbers aka accountid.
In order to convert from these 32-bit numbers to Steam Names, you must first convert between the 32-bit ID and 64-bit ID: On a system that supports up to 64-bit numbers you can do the following:
- STEAMID64 - 76561197960265728 = STEAMID32
- STEAMID32 + 76561197960265728 = STEAMID64
- OR
- STEAMID32 = The right-most 32-bits of STEAMID64
- STEAMID64 = concatenate("00000001000100000000000000000001", STEAMID32);
Convert AccountID to SteamID64 in PHP
function A2S($id32) { return bcadd($id32,'76561197960265728'); } function S2A($id64) { return bcsub($id64,'76561197960265728'); }
How to get someone's 64-bit ID to search with:
If you have their vanity URL, it should look like this:
http://steamcommunity.com/id/http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=&vanityurl=
If you have an ID url:
http://steamcommunity.com/profiles/Then the
If you have just a Steam-Name:
You can use this to search the Dota2 API directly using the player_name option of GetMatchHistoryYou can then find their 32-bit ID in the list and then convert it to a 64-bit ID as above.
I just added convert function
Source: http://dev.dota2.com/showthread.php?t=58317