Bitcoin Forum
May 06, 2024, 08:04:09 PM *
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 1963 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

1715025849
Hero Member
*
Offline Offline

Posts: 1715025849

View Profile Personal Message (Offline)

Ignore
1715025849
Reply with quote  #2

1715025849
Report to moderator
1715025849
Hero Member
*
Offline Offline

Posts: 1715025849

View Profile Personal Message (Offline)

Ignore
1715025849
Reply with quote  #2

1715025849
Report to moderator
"There should not be any signed int. If you've found a signed int somewhere, please tell me (within the next 25 years please) and I'll change it to unsigned int." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
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!