0

Hello I am trying to echo the "avrage_price" price of a item but I don't know why my code isn’t working, Help would be great. here is my code,

($name is a valid variable that when i echo works)

(I put myKey where I would normally put my key to hide my key)

$apiUrl = "http://api.csgo.steamlytics.xyz/v1/prices/$name?key=myKey";
$jsonApi = json_decode(file_get_contents($apiUrl));

echo $jsonApi['avrage_price'];
j08691
  • 204,283
  • 31
  • 260
  • 272
person
  • 88
  • 10
  • Debugging tips: 1) What happens when you`var_dump($jsonApi)`? 2) Just to be safe: `var_dump($apiUrl)` too to make sure it is what you think it is. 3) you might need to port `file_get_contents()` to the equivalent curl functions to check if the request is actually succeeding. And a side note: steamlytics doesn't appear to be affiliated with Valve - so the steam-web-api tag is probably inappropriate. – HPierce Aug 30 '16 at 00:45
  • I wonder if you need to send specific header values, check out example #4 (Example #4 Using stream contexts) http://php.net/manual/en/function.file-get-contents.php – Perspective Aug 30 '16 at 00:48

1 Answers1

0

Im stupid i had average_price spelt wrong FML

person
  • 88
  • 10