Here you have for free...
function get_content($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$string = ob_get_contents();
ob_end_clean();
return $string;
}
$btcprice = get_content ('
https://blockchain.info/es/q/24hrprice ');
{
$usd= "$_POST['input']";
$none= "0";
$result= ($usd / $btcprice);
}
if ($usd>$none)
{
print "
$ " . $usd . " = " . $result . " BTC
\n";
}
?>
That´s for "Calculate USD -> BTC", for "Calculate BTC -> USD" just change the variables.