6
2
This is a pretty classic programming question, but I think it is a very common one for the Bitcoin community, and would be helpful to have the code publicly available.
My preference is for a php script.
Bitpay publishes it's exchange rates here: https://bitpay.com/api/rates
If an item is $10 USD, how would I do the following?
1) extract the BTC/USD exchange rate from the array at this URL
2) Define the price, then divide by the exchange rate
3) Display the BTC price in an HTML page?
1This didn't work for me, instead it simply output "Price $/BTC"
I don't know PHP well, but some googling led me to replace the last three lines with:
<?php echo "<ul> <li> Price: $usd_price $ / $bitcoin_price BTC </ul>"; ?>
(the elephant image wouldn't be so bad if it was less massive) – mardlin – 2013-08-05T18:50:27.033
1
Enable "show errors" for php, and look whats wrong. http://php.net/manual/ru/errorfunc.configuration.php
– None – 2013-08-05T19:39:07.450