Simple Blockchain Api for exchange rate in different currency.
Get the amount of Bitcoin that could be purchased for a given fiat amount. Returns a float.
$url = "https://blockchain.info/tobtc?currency=".$currency."&value=".$amount;
$amount = 10000;
$currency = "USD";
$url = "https://blockchain.info/tobtc?currency=".$currency."&value=".$amount;
$json = file_get_contents($url);
$data = json_decode($json, TRUE);
<ul>
<li>Price: <?=$data ?> BTC
</ul>
you can tweak the function below to your taste
public function btcprice()
{
$url = "https://blockchain.info/tobtc?currency=".$currency."&value=".$amount;
$json = file_get_contents($url);
$data = json_decode($json, TRUE);
return $data;
}