I have this issue with this little bitcoin ticker code I'm trying to put on my site bitcoinvalues.net, I used to work pulling the data from Mt.Gox but not anymore cause they shutdown their site. What I want to do now is replacing Mt.Gox with either bitstamp.net/api/ticker/ and blockchain.info/ticker ticker. The codes are below. Can you guys help me with this?
<?php
//first fetch the current rate from MtGox
$ch = curl_init('https://mtgox.com/api/0/data/ticker.php');
curl_setopt($ch, CURLOPT_REFERER, 'Mozilla/5.0 (compatible; MtGox PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
curl_setopt($ch, CURLOPT_USERAGENT, "CakeScript/0.1");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$mtgoxjson = curl_exec($ch);
curl_close($ch);
//decode from an object to array
$output_mtgox = json_decode($mtgoxjson);
$output_mtgox_1 = get_object_vars($output_mtgox);
$mtgox_array = get_object_vars($output_mtgox_1['ticker']);
?>
<br/>
<br/>
Last: <?php echo $mtgox_array['last']; ?><br/>
High: <?php echo $mtgox_array['high']; ?><br/>
Low: <?php echo $mtgox_array['low']; ?><br/>
Avg: <?php echo $mtgox_array['avg']; ?><br/>
Vol: <?php echo $mtgox_array['vol']; ?><br/>