I'm writing a script to accept Bitcoin payments. My $json variable returns null. var_dump() returns NULL.
I am using the following code:
$receiving_address = BITCOIN_ADDRESS;
if(get_magic_quotes_gpc()){
$callback_url = urlencode(stripslashes(CALLBACK_URL));
} else {
$callback_url = urlencode(CALLBACK_URL);
}
$ch = curl_init("https://blockchain.info/api/receive?method=create&address=$receiving_address&shared=false&callback=$callback_url");
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$json=json_decode(curl_exec($ch),true);
var_dump($json);
echo $json[0]->text;