Bitcoin Forum
June 21, 2024, 10:25:24 PM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Problem with blockchain.info api php  (Read 1044 times)
pulser (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
July 05, 2014, 05: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
m3
Sr. Member
****
Offline Offline

Activity: 460
Merit: 250


View Profile WWW
July 05, 2014, 11: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

rarkenin
Hero Member
*****
Offline Offline

Activity: 784
Merit: 500



View Profile
July 05, 2014, 11:08:33 PM
 #3

Are stream wrappers working? What if you file_get_contents google's homepage or something? Or, could you try cURL?
pulser (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
July 06, 2014, 03:11:27 PM
 #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
Initscri
Hero Member
*****
Offline Offline

Activity: 1554
Merit: 759


View Profile WWW
July 07, 2014, 02:33:56 AM
 #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.

----------------------------------
Web Developer. PM for details.
----------------------------------
KingOfSports
Hero Member
*****
Offline Offline

Activity: 602
Merit: 500

Acc bought - used solely for signature testing


View Profile
July 07, 2014, 04:32:49 AM
 #6

Been giving my coder issues for awhile now.

.







.
Initscri
Hero Member
*****
Offline Offline

Activity: 1554
Merit: 759


View Profile WWW
July 07, 2014, 06: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

----------------------------------
Web Developer. PM for details.
----------------------------------
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!