originally posted in:BungieNetPlatform
Trying to get my head around the API, by making a simple CURL call. I tried:
[quote]curl -H "X-API-Key: <myapikey>" http://www.bungie.net/platform/Destiny/SearchDestinyPlayer/1/Syropian/[/quote] but I just got this back:
[quote]{"Response":[{"iconPath":"/img/theme/destiny/icons/icon_xbl.png","membershipType":1,"membershipId":"4611686018439274225","displayName":"Syropian"}],"ErrorCode":1,"ThrottleSeconds":0,"ErrorStatus":"Success","Message":"Ok","MessageData":{}}[/quote]
Any ideas where I went wrong?
-
Edited by Godly: 2/9/2015 4:20:47 PMHey, I use file_get_contents in a function like this: [quote] function getUrlContent($url) { $context = stream_context_create(array( 'https' => array( 'method' => 'GET', 'header' => "Host: www.YourURL.com\r\nX-API-Key: YourAPIKey\r\n" ) )); $urlContent = file_get_contents("https://www.bungie.net/" . $url, false, $context); return $urlContent; }[/quote] Your response looks good actually! You need to extract the membershipId (4611686018439274225) and use that to query further. Here's some more code to give you an idea: [quote]$url = "Platform/Destiny/SearchDestinyPlayer/" . $v_platform . "/" . $v_userId . "/"; $urlContent = getUrlContent($url); $jsonObj = json_decode($urlContent, true); $responseObj = $jsonObj['Response'][0]; $this->membershipId = $responseObj['membershipId']; if($this->membershipId == null){ return; //This will return basic info for that gamertag $url = "Platform/Destiny/Tiger" . $platformStr . "/Account/" . $membershipId . "/"; $urlContent = getUrlContent($url); $jsonObj = json_decode($urlContent, true); $dataObj = $jsonObj['Response']['data']; }[/quote]
-
Did you try turning it off and back on?
-
Uhh...