Author

Topic: Problem with blockchain.info api php (Read 1057 times)

hero member
Activity: 1582
Merit: 759
July 07, 2014, 02:23:04 AM
#7
For the op:

Remove the @ before file_get_contents and make sure you have the correct error_reporting turned on.

It should provide you with an error for further troubleshooting.

Edit: Also check that you have allow_url_fopen enabled and your webhost did not disable that feature.
Posted from Bitcointa.lk - #Lxv671f3LR0D02HU
hero member
Activity: 602
Merit: 500
Acc bought - used solely for signature testing
July 07, 2014, 12:32:49 AM
#6
Been giving my coder issues for awhile now.
hero member
Activity: 1582
Merit: 759
July 06, 2014, 10:33:56 PM
#5
Are there any errors with regards to Curl or file_get_contents.

Have you tried checking your error log or using print_r() on the variable.

Try including
Code:
print_r($data);

on the above code somewhere and depending on where you are running the script, copy and paste the output.
newbie
Activity: 13
Merit: 0
July 06, 2014, 11:11:27 AM
#4
Hello thanks for your reply

This night is work, and now not working... I dont have other module, i use file get content and cURL with google.com its work

Code:
$url = 'https://blockchain.info/';

function urlExists($url=NULL)
{
if($url == NULL) return false;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode>=200 && $httpcode<=303){
return true;
} else {
return false;
}
}

if(urlExists($url))
{
   echo "ok blockchain";
}
else
{
  echo "switch coinbase";
}


@M3 u use api ? U dont have problem with this ? This night all work and this morning not... lol
hero member
Activity: 784
Merit: 500
July 05, 2014, 07:08:33 PM
#3
Are stream wrappers working? What if you file_get_contents google's homepage or something? Or, could you try cURL?
m3
sr. member
Activity: 460
Merit: 250
July 05, 2014, 07:07:45 PM
#2
if it worked before but stopped working now then maybe you have some php issues on your server I would double check that because the blockchain.info api works fine for me. Any changes you made to the server or plugins you installed? Maybe they are interferring
newbie
Activity: 13
Merit: 0
July 05, 2014, 01:45:22 PM
#1
Hello all

I have problem for generat new deposit address with PHP. In browser is ok

https://blockchain.info/api/receive?method=create&address=1Mt8WDeuLd9s1eyzRZcdFy79m1cPvCR5YC
With this link in my browser its work i have
Code:
{"input_address":"1GaoqyHB9FzKksTxqFs74WXVrvuzsU16XY","fee_percent":0,"destination":"1Mt8WDeuLd9s1eyzRZcdFy79m1cPvCR5YC"}


In php with file_get_contents not working... i have always empty response
Code:
$response = @file_get_contents('https://blockchain.info/api/receive?method=create&address=1Mt8WDeuLd9s1eyzRZcdFy79m1cPvCR5YC');

The last week all work, today no...

With coinbase is ok

Is my code the problem or blockchain ?

Thanks you  Smiley
Jump to: