0

So I am trying to get some information from a JSON file. But for some reason there is no actual response with the information that I need.

This is the code im running.

$json_object = file_get_contents('http://steamcommunity.com/profiles/'.$steamID.'/inventory/json/730/2');
$json_decoded = json_decode($json_object); 
echo $json_decoded->success;

I get the steamID from a cookie. But if you want to see how the JSON looks, then you can check out this link: http://steamcommunity.com/profiles/76561198031313244/inventory/json/730/2

Sandis
  • 17

2 Answers2

0

The problem is that the URL you are checking is redirected to another URL, file_get_contents() doesn't support following redirects AFAIK, so you should better use cURL

Check this answer https://stackoverflow.com/a/4324018/5658508

Community
  • 1
  • 1
Mahmoud Tantawy
  • 713
  • 5
  • 12
0

the problem is like the others tell you is in this link http://steamcommunity.com/profiles/76561198031313244/inventory/json/730/2

i just monitor the response, so when you visit the link you get a 302 Moved Temporarily http response to the new link which is http://steamcommunity.com/id/SANDISS/inventory/json/730/2

you can try to get contents using file_get_contents if you have the link not just a steam id, or use curl library