Author

Topic: Chart for website. (Read 954 times)

newbie
Activity: 32
Merit: 0
November 09, 2013, 05:47:43 AM
#6
Anytime, i made it easy to implement other exchanges in the future to.
newbie
Activity: 17
Merit: 0
November 09, 2013, 05:43:12 AM
#5
newbie
Activity: 32
Merit: 0
November 09, 2013, 05:08:05 AM
#4
https://www.bitstamp.net/api/

https://btc-e.com/api/2/btc_usd/ticker

Code:

        
function getStats($e) {
            
$cookies tmpfile();
            
$userAgent 'duxZero';

            
$eURL NULL;

            switch (
$e) {
                case 
"btc-e":
                    
$eURL "https://btc-e.com/api/2/btc_usd/ticker";
                    break;
                case 
"bitstamp":
                    
$eURL "https://www.bitstamp.net/api/ticker/";
                    break;
                default:
                    
$eURL "https://www.bitstamp.net/api/ticker/";
                    break;
            }

            
$cURL curl_init($eURL);

            
$options = array(
                
CURLOPT_CONNECTTIMEOUT => 20,
                
CURLOPT_USERAGENT => $userAgent,
                
CURLOPT_AUTOREFERER => true,
                
CURLOPT_FOLLOWLOCATION => true,
                
CURLOPT_RETURNTRANSFER => true,
                
CURLOPT_COOKIEFILE => $cookies,
                
CURLOPT_COOKIEJAR => $cookies,
                
CURLOPT_SSL_VERIFYPEER => 0,
                
CURLOPT_SSL_VERIFYHOST => 0
            
);

            
curl_setopt_array($cURL$options);
            
$contents curl_exec($cURL);
            
curl_close($cURL);
            return 
json_decode($contentstrue);
        }

        
$a getStats("btc-e");
        echo 
$a['ticker']['high'];

        echo 
"
"
;

        
$b getStats("bitstamp");
        echo 
$b['high'];
        
?>

newbie
Activity: 17
Merit: 0
November 09, 2013, 04:47:48 AM
#3
Just use the API's for the big popular exchanges.

I can even give you a snippet that does this if need be.


That be awesome thank you! I need to learn more about how JSON and how the different APIs work lol.
newbie
Activity: 32
Merit: 0
November 09, 2013, 04:44:36 AM
#2
Just use the API's for the big popular exchanges.

I can even give you a snippet that does this if need be.
newbie
Activity: 17
Merit: 0
November 09, 2013, 02:43:14 AM
#1
Hello, I would like to put a chart on my website that shows the current BTC-e and Bitstamp BTC price. However I am not quite sure how to do this. I have a feeling it would be PHP parsing JSON from the exchanges but I'm not quite sure. Anyone know how to do this that could help? Smiley
Jump to: