Title: Displaying active bitcoin stats on my webpage Post by: Houseonfire on November 28, 2011, 07:45:34 AM I'm having a hard time figuring out how to display current mtgox stats on my web page.
I honestly have no idea where to start, and I can't find anything helpful online for how to do it. The page I want to display on is my bithopper mining stats page, so its an html page. I have the APIs from MtGox and tradehill but I don't know how to use them. Title: Re: Displaying active bitcoin stats on my webpage Post by: Houseonfire on November 30, 2011, 09:22:58 AM Is there anyone willing to help? I just want it displayed on my own page that me and a few friends are using.. It's nothing commercial or anything. The BitHopper people aren't helping me any, so i'm looking to the community for help.
Thanks Title: Re: Displaying active bitcoin stats on my webpage Post by: phorensic on December 03, 2011, 04:32:18 AM Here is how I did it on my old mining pool website with PHP and mySQL from TradeHill, which is *very* similar to how you would do it with MtGox, unless you want to use websocket/sockets.io for live AJAX stuff.
Code: $file = fopen("https://api.tradehill.com/APIv1/USD/Ticker", "rb"); This accessed a table in MySQL called websiteSettings in my main DB. You don't need a database, but it makes it easier to reduce load on your website because you can pool every N times, instead of every time the page loads. Then you run this somewhere in your PHP code before you want to call the variable: Code: $tradeHillQ = mysql_query("SELECT `tradeHillWorth` FROM `websiteSettings`"); Then you run this when you want to insert the price in the output of the HTML page: Code: <?php echo round($tradeHillWorth->tradeHillWorth, 2);?> The code above will round it to two decimal places. Again, this is very, very similar to how you would do it for any exchange. Just read their API documentation. |