0

I want to get a list of all the items with prices from dota 2. Using this code:

     <?$urll2 = "http://api.steamapis.com/market/items/570?api_key=******";
    enter code here$urljson2 = file_get_contents("$urll2"); 
    $data2 = json_decode($urljson2); 
    echo $data2; 
?>

And displays this error:

Warning: file_get_contents(http://api.steamapis.com/market/items/570?api_key=4E465E3EC414FE37DAE8357EF7F01863) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized

Dima
  • 21
  • 3

1 Answers1

0

You'll want to go to https://steamapis.com/ and sign up there. It's a third-party API so you need an API key from them, not from Steam. If you were using your Steam API key that's why it wasn't working. I would also recommend revoking your Steam API key as it's meant to be private (do so from http://steamcommunity.com/dev/apikey).

Optimae
  • 942
  • 1
  • 12
  • 23
  • Thx, but can I do the same use the Steam API only? – Dima Apr 13 '17 at 10:01
  • Unfortunately, I don't think you can use your Steam API key with them as it's a third-party service. At the bottom of the SteamAPIs.com website you'll see that it says: `This site is not affiliated with Valve, Steam, or any of their partners.` For a list of what you _can_ do with your Steam API key, go to: https://developer.valvesoftware.com/wiki/Steam_Web_API – Optimae Apr 13 '17 at 10:03