Hi.
I need to understand, how to get [B]customURL[/B], if i have only [B]steamID64[/B]
User entering in "Input" [B]steamID64[/B].
I check by link:[PHP]$var = "http://steamcommunity.com/profiles/$varinput/?xml=1";
$url = simplexml_load_file($var);[/PHP]
but if user have [B]customURL[/B], link will be[PHP]http://steamcommunity.com/id/*customURL*/?xml=1[/PHP]
And i get null in my "simplexml_load_file".
How to get customURL for this link?
In
[I][url]http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=*myapikey*&steamids=*steamID64*[/url][/I]
haven't customURL.
Sorry, for my English
Convert it to a community ID instead. Here's the algorithms:
[code]
function CommunityIDToSteamID($id) {
$steamIDEnd = bcsub($id, "76561197960265728") / 2;
return "STEAM_0:" . (is_float($steamIDEnd) ? "1" : "0") . ":" . round($steamIDEnd);
}
function SteamIDToCommunityID($id) {
return bcadd(bcmul(substr($id, 10), "2") - (substr($id, 8, 1) == "1" ? 0.5 : 0), "76561197960265728");
}
[/code]
If you query the [url]http://steamcommunity.com/id/*customURL*/?xml=1[/url] you can get the SteamID64 from steamID64 tag.
OP already has the steamID64, he's asking how to get the user's custom URL.
If you used the proper API with an API key it will always accept the steamID64.
If the user uses customURL, the page [B]/profiles/xxxxx[/B] will be redirected to [B]id/*customurl*[/B]
I ask how can I get customURL having steamID64, and not vice versa.
Sign up for an API key if you haven't already. [URL="http://steamcommunity.com/dev/apikey"]http://steamcommunity.com/dev/apikey[/URL]
[code]http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=[APIKEY]&steamids=[STEAMID64]&format=xml[/code]
The <profileurl> element has what you need. Although it's much easier in PHP to use JSON:
[PHP]
$url = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' .$apikey. '&steamids=' .$steamid64. '&format=json';
$data = json_decode(file_get_contents($url),true);
$profileurl = $data['response']['players']['profileurl'];
[/PHP]
[B]CBastard[/B], thanks.
<profileurl> - is what is needed
Sorry, you need to Log In to post a reply to this thread.