18343/extract-data-from-json-url-result-php
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 }
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. What am I doing wrong?
Try this code, it worked for me:
$balance = $json["balance"]; echo $balance;
Yes, you can do it use the ...READ MORE
Try this: print r.json()['address'],' has ', r.json()['n_tx'], 'tr ...READ MORE
use inArray function. example: $.getJSON("//api.coinmarketcap.com/v1/ticker/?limit=0", function(data) { ...READ MORE
web3.eth.getTransaction(txHash) will returns transaction details like blockHash, transactionIndex, ...READ MORE
Just remove the json_encode call, and it should work: $resp ...READ MORE
/** * Firstly collect the ...READ MORE
Convert the recipes into JSON objects. x = ...READ MORE
I tried the following code and it ...READ MORE
you can do it by writing a ...READ MORE
You are using web3.eth.getTransaction(txHash) web3.eth.getTransaction(txHash) will only return info ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.