$json_string = 'http://pubapi.cryptsy.com/api.php?method=marketdatav2';
$jsondata = file_get_contents($json_string);
I am new in php. Maybe its stupid question. But what is the easiest way to get lastestprice of all markets?
$json_string = 'http://pubapi.cryptsy.com/api.php?method=marketdatav2';
$jsondata = file_get_contents($json_string);
I am new in php. Maybe its stupid question. But what is the easiest way to get lastestprice of all markets?
Use json_decode
function to convert json string to array & traverse the array accordingly.
$jsondata = file_get_contents($json_string);
$array = json_decode($jsondata,true);
foreach($array['return']['markets'] as $lprice) {
$latest_price[$lprice['label']] = $lprice['lasttradeprice'];
}
echo "<pre>";
print_r($latest_price);
echo "<pre>";