R. Rio R. Rio - 5 months ago 10
PHP Question

Can't read a string of JSON

I have this JSON (is from Steam Market):


And I have this code:

$urlm = 'http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name='.$name;
$market = json_decode(file_get_contents($urlm), true);
echo $market['lowest_price'];

But when I try it, they give me an error:

Notice: Undefined index: lowest_price

What is wrong? Because I have an other JSON with the same method and works perfect.


You should urlencode your varaiable:

$urlm = 'http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name='. urlencode($name);