Help Fixing Bitcoin Price Index PHP Script

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Thu May 22, 2014 5:22 pm

Help Fixing Bitcoin Price Index PHP Script

Postby helpmeplease » Thu May 22, 2014 5:28 pm

I've been trying to fix this little php bitcoin price index for almost a month now for my site until I found out I don't knwo anything about php. The script is using Mt.Gox to pull the current bitcoin prices but they went out of business so it's no longer working. I would like to replace Mt.Gox with either and ticker. Can anyone please throw me a bone? Thanks in advance. Script below:

Code: Select all

         //first fetch the current rate from MtGox
         $ch = curl_init('');
                 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);
         //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']);
 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/>

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests