Help with Bitcoin Value Index

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muttfox
    New Member
    • May 2014
    • 1

    Help with Bitcoin Value Index

    Hello, I'm using this PHP script to pull a single bitcoin price from Mt.Gox. However, Mt.Gox shut down and now script is not working. I'm trying to use another API like bitstamp.net/api/ticker/ and blockchain.info/ticker. I have tried everything but the script is not working. I really need help with this. this is for a site I'm developing for a client of mine named BitCoinValues.n et

    Regards
    Matt

    Code:
    <?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:&nbsp;<?php echo $mtgox_array['last'];   ?><br/>
     High:&nbsp;<?php echo $mtgox_array['high'];   ?><br/>
     Low:&nbsp;&nbsp;<?php echo $mtgox_array['low'];   ?><br/>
     Avg:&nbsp;&nbsp;&nbsp;<?php echo $mtgox_array['avg'];   ?><br/>
     Vol:&nbsp;&nbsp;&nbsp;<?php echo $mtgox_array['vol'];   ?><br/>
Working...