api - bitcoin to currency converter and it's reverse in php -


i using bitcoin currency converter in php.so can convert bitcoin currency (say usd) , currency (say usd) bitcoins.

is there api ?? till using url convert currency bitcoins https://blockchain.info/tobtc?currency=usd&value=83.652

but how it's reverse (convert bitcoins currency).also don't know whether result correct or not.

i used mtgox api achieve available http or streaming web socket

edit:

ok, can value doing this:

//set currency $currency = 'usd'; //get json response $return = file_get_contents('http://data.mtgox.com/api/1/btc'.$currency.'/ticker_fast'); //decode (into array rather object [using 'true' parameter]) $info = json_decode($return, true); //access dollar value $value = $info['return']['last_local']['value']; 

it's public api don't need authenticate, contents of page in json format , decode array , access value element.

you know 1 btc = 90.20505 dollars - therefore 1 dollar equal 0.0110858 bitcoins. (1 / 90.20505).

you can currency.

voila

update:

for new readers of question, solution no longer works based on mtgox going under see nathan's working solution below.


Comments