- file_get_contents: documentation ( source)
- json_decode: documentation ( source)
- rawurlencode: documentation ( source)
- str_replace: documentation ( source)
- str_split: documentation ( source)
<?php
$itemname = rawurlencode("Tec-9 | Isaac (Field-Tested)");
echo $itemname.'<br>';
$addy = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=".$itemname;
$price = json_decode(file_get_contents($addy));
if($price->success == 'true') {
if($price->median_price) {
echo intval(str_replace(str_split('$.'), '', $price->median_price));
} else {
echo 'No median price set.';
}
} else {
echo 'Unable to retrieve price data.';
}
echo '<hr>';