PHP API for Current Bitcoin Price

According to Wikipedia, Bitcoin is a cryptocurrency, a form of electronic cash.  Cryptocurrency is basically a digital currency in which encryption techniques are used to regulate the generation of units of currency and verify the transfer of funds, operating independently of a central bank.

A cryptocurrency is a digital or virtual currency designed to work as a medium of exchange. It uses cryptography to secure and verify transactions as well as to control the creation of new units of a particular currency. Essentially, cryptocurrencies are limited entries in a database that no one can change unless specific conditions are fulfilled.

The concept was born out of the need for secure communication in the Second World War. It has evolved in the digital era with elements of mathematical theory and computer science to become a way to secure communications, information and money online.


Bitcoin

According to Wikipedia, Bitcoin is a cryptocurrency, a form of electronic cash. Bitcoin uses peer-to-peer technology to operate with no central authority or banks; managing transactions and the issuing of coins is carried out collectively by the network. KIt is open-source; its design is public, nobody owns or controls Bitcoin and everyone can take part.

Number of bitcoin transactions per month

Fig. Number of bitcoin transactions per month (logarithmic scale)


PHP Script to get Current Bitcoin Rates in various currencies

In order to get rates in various currencies, we can simply use API provided by Bitpay.

<?php $url = "https://bitpay.com/api/rates"; $json = json_decode(file_get_contents($url)); $dollar = $btc = 0; foreach($json as $obj){ echo '1 bitcoin = $'. $obj->rate .' '. $obj->name .' ('. $obj->code .')<br>'; }
?>

You can follow this tutorial for complete guidance :

About The Author

Ritesh Ghimire

Ritesh is a Computer Engineer, Web Developer and an active cricket follower.

Related Posts