0

Hello I am trying to query the site URL which will return a dynamic json file containing the following information...

{"input_address":"1BEgj5JUUsUz91bR9F6q6YoUPgtAGWAZg9","destination":"1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq","fee_percent":0}

I need to extract the input_address from that json file. This is probably easy although I am very new to php, here is what i have located in xx.php...

<?php
$root_url = 'https://blockchain.info/api/receive?method=create&address=1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq';
$agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)':
$ch = curl_init();
curl_setopt($ch, CURL_SSL_VERIFYPEER, false);
curl_setopt($ch, CURL_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, 'Content-type:application/json');
curl_setopt($ch, CURLOPT_URL, $root_url);
curl_setopt($ch, CURLOPY_USERAGENT, $agent);
$result=curl_exec($ch);
curl_close($ch);
$gg = json_decode($result);
var_dump(json_decode($result));
$hh = var_dump($gg['input_address']);
//$zz = json_decode($result);
echo 'blah:'. $gg;
echo 'hh:'. $hh;
?>

When I go to xx.php it is returning a blank page and I thought it should return a page that echos the contents of the entire json file? Any help is appreciated.

4

0 回答 0