Bitcoin Forum
May 26, 2024, 02:24:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: HELP! Need to automate live bitcoin exchange rate.  (Read 1965 times)
Bobby (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
March 04, 2011, 12:14:03 AM
 #1

Basically I'm going to be selling certain items on my website such as Gold, Silver coins, etc.  I would like to accept bitcoin in payment but I need to be able to update the price in accordance to the bitcoin/USD exchange rate.  Since my website is written in PERL/CGI is there an easy way to obtain the latest exchange rate (current BID on MTGOX for example) and import it into a variable that I would use to update my prices in real time?  It's easy to look up manually but how would I write a script that would be able to look up the value?

Also would need to look up the spot price of Gold and Silver (in USD) at the same time.

There seem to be a lot of geniouses here so thanks in advance for any advice!

Bobby

Quip
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile
March 04, 2011, 12:22:36 AM
 #2

No idea about perl, but in PHP:
Code:
$goxPrice = json_decode(file_get_contents("http://mtgox.com/code/data/ticker.php"))->{'ticker'}->{'sell'};
You can use "buy", "sell", or "last" based on your needs.
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
March 04, 2011, 12:40:28 AM
 #3

Since my website is written in PERL/CGI

Try to search recent forum posts, yesterday somebody posted PERL code for parsing mtgox quotes...

Edit: Link to Perl module is on the wiki. Nice job, mndrix!

Bobby (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
March 04, 2011, 12:56:08 AM
 #4

Exactly what I needed!  No longer BitCoin related but does anyone know a script that can fetch the spot price of Gold/Silver??

Thanks!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!