I'm using PHP and JSON from Google finance to get real-time stock updates/quotes using http://finance.google.com/finance/info?client=ig&q=GOOG (this is just an example) My code works fine with above mentioned link (because it only has one stock that I want to get i.e GOOG) but if I try to add few more stock symbols at the end
{
<?php
<?php $url="http://finance.google.com/finance/info?client=ig&q=GOOG,AAPL,MAC "
/* (here I'm trying to get data for 3 stocks (i.e GOOG, AAPL, MAC)
it generates the JSON but I'm unable to change it into proper Array.*/
$g_f_data= file_get_contents($url);
$json = str_replace("
", "", $g_f_data);
$data = substr($json, 4, strlen($json) -5);
$json_output = json_decode($data, true);
echo"<pre>";
print_r ($json_output);
echo"</pre>";
echo $json_output['t'],$json_output['l'],$json_output['cp'];echo "<br />";
?>
}