Question

sorry for my bad english.

I want convert steamapi (json) to php variables. How can i do that?

I'm using this code:

$api = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=5E78FFBEBC11204E33F589AA5E027F82&steamids=76561197960435530";

$json = file_get_contents($api);

$decoded = json_decode($json);

print_r($decoded->{'response'}->{'players'}->{'steamid'});

I want show the steamid.

Was it helpful?

Solution

Try this

print_r($decoded->response->players[0]->steamid);

players is an array, so you must take its first element.

OTHER TIPS

It doesn't work json_decode? This should work you have the json in $decoded. If you want steamid you have to do this:

$obj->{'steamid'};

I hope this can help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top