This example is to get the Bitcoin rate :
NOTE: Enable/uncomment openssl from your wampserver file(php.ini) if you are running this locally.
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-format="fluid"
data-ad-layout="in-article"
data-ad-client="ca-pub-7978017426847037"
data-ad-slot="8273492106"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<?php
$url = "https://bitpay.com/api/rates";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result= curl_exec ($ch);
curl_close ($ch);
$data = json_decode($result, TRUE);
$count = count($data);
$rate = $data[1]["rate"];
$rate = number_format((float)$rate, 2, '.', '');
echo $rate;
?>
NOTE: Enable/uncomment openssl from your wampserver file(php.ini) if you are running this locally.
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-format="fluid"
data-ad-layout="in-article"
data-ad-client="ca-pub-7978017426847037"
data-ad-slot="8273492106"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<?php
$url = "https://bitpay.com/api/rates";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result= curl_exec ($ch);
curl_close ($ch);
$data = json_decode($result, TRUE);
$count = count($data);
$rate = $data[1]["rate"];
$rate = number_format((float)$rate, 2, '.', '');
echo $rate;
?>
SHARE THIS POST
0 comments:
Post a Comment