I am trying to run a url for getting balance of a address.
URL: https://dogechain.info/api/v1/address/balance/DMr3fEiVrPWFpoCWS958zNtqgnFb7QWn9D
Which gives the JSON:
{
"balance": "1682049.83191666",
"success": 1
}
(Balance may vary time to time)
I am trying to extract the "balance" with the code:-
<?php
$url = "https://dogechain.info/api/v1/address/balance/DMr3fEiVrPWFpoCWS958zNtqgnFb7QWn9D";
$json = json_decode(file_get_contents($url), true);
$balance = json("balance")
echo $balance
?>
But it returns nothing please help me =)
You should do it like this