Simple Tutorial - How to add your bitcoin wallet balance to your php website
Hello, today I show you how to add your bitcoin wallet balance on your website with a simple code but remember this only works with one single bitcoin address,
I installed Xampp server on my laptop and I'm also going to use wordpress for this tutorial.
So first of all you need to retrieve your balance from your bitcoin address for this tutorial I'm going to use blockchain.info's API here is the addrss :
https://blockchain.info/q/addressbalance/your-address
which is explained in here
https://blockchain.info/q
I have 0.2319 BTC in my wallet :
![blockchaininfomybal.jpg]
(
if you paste the above address in your browser you'll see this :
remember the number is not a float number so you have to multiply it by 0.00000001 (please correct me if I'm wrong cause this works for me).
Then we are going to use this php code to retrieve json data from blockchain.info's API :
<?php
$url = "https://blockchain.info/q/addressbalance/MY-ADDRESS here";
$json = file_get_contents($url);
$json_data = json_decode($json, true);
echo "<h1> My Balance: ". $json_data * 0.00000001 ."</h1>";
?>
here is my code :
and this is the final result :