Bitcoin to US Dollar conversion in PHP

In this example we will use cryptonator’s api to show a conversion from bitcoin to USD.

For more information about the api visit –¬† From the website

Cryptonator provides unique volume of cryptocurrency exchange rates data, which is delivered in easy-to-integrate JSON format via simple HTTPS requests. Prices are updated every 30 seconds, covering 300+ cryptocurrencies across 62 exchanges.

You can get a list of cryptocurrencies supported by visiting

Lets take a look at an example in PHP


$url = "";
$data = json_decode(file_get_contents($url), true);
$ticker = $data['ticker'];
$latest_price = $ticker['price'];
echo "1 Bitcoin = " . "$latest_price" . " US Dollars";

<title>BTC to USd Price Converter</title>
<meta content='10' http-equiv='refresh'/> <!-- Reloads Page every 10 seconds -->





You should see something like this, depending on the current bitcoin price

1 Bitcoin = 9127.96826769 US Dollars