Title: Bitcoin PHP currency converter Post by: BitDave on October 17, 2012, 09:17:21 PM I want to accept bitcoins on my ecommerce site for payment of goods. I'll accept them manually for now, generating an address for each customer, but as a minimum I need to display the visitor's checkout total in both USD and bitcoins. Is there a way of getting data from a server on what the current bitcoin exchange rate is via PHP?
Title: Re: Bitcoin PHP currency converter Post by: BCB on October 17, 2012, 09:54:02 PM Code: function mtgox_query($path, array $req = array()) { Title: Re: Bitcoin PHP currency converter Post by: BCB on October 17, 2012, 10:28:04 PM You could also be using
Code: function JSONtoAmount($value) { to convert floats and avoid rounding errors. This is explained here. https://en.bitcoin.it/wiki/Proper_Money_Handling_(JSON-RPC) Title: Re: Bitcoin PHP currency converter Post by: BCB on October 17, 2012, 10:29:19 PM You could also be using Code: function JSONtoAmount($value) { to convert floats and avoid rounding errors. or just use the mount gox "value_int" value and convert to decimal for display. This is explained here. https://en.bitcoin.it/wiki/Proper_Money_Handling_(JSON-RPC) Title: Re: Bitcoin PHP currency converter Post by: alexanderrrr on November 05, 2012, 05:58:49 AM Thanks for the codesnippets. Useful.
Title: Re: Bitcoin PHP currency converter Post by: svirus on November 08, 2012, 11:27:15 AM From php 5.0.0 you can change this
Code: $mt = explode(' ', microtime()); Code: $req['nonce'] = microtime(true); |