php - I get NULL retrieving JSON from especific website -
i want retrieve json data here:
{ "input_address": "1bee32k9fxvrnbneukwdym26vz4gsggqzg", "callback_url": "http://example.com", "fee_percent": 1.5, "destination": "12za1i1zhytcehwbg8yjb72beegqveumdt" }
... if put on browser you'll see json data correctly formatted. no problem there.
however, when try retrieve data php using standard script:
<?php $url = 'https://blockchain.info/api/receive?method=create&format=plain&anonymous=true&address=12za1i1zhytcehwbg8yjb72beegqveumdt&callback=http%3a%2f%2fexample.com'; $json = file_get_contents($url); $data = json_decode($json); var_dump($data); echo 'url: '.$url; ?>
... no data; var_dump writes "null" (you can test previous code @ http://bitstamina.com/theamazinghat/thehat.php). , yet, if try other url returns json data code works perfectly.
what doing wrong? must either stupid mistake on part, or site blockchain.info has blocked site making requests.
i believe due cross domain mismatch. changing page https or call using http. http://blockchain.info/api/receive?method=create&format=plain&anonymous=true&address=12za1i1zhytcehwbg8yjb72beegqveumdt&callback=http%3a%2f%2fexample.com
this works.
Comments
Post a Comment