Unable to establish connection to bitcoin using json and php

1

I'm newbie to bitcoins. Im trying to get the info, as much as I can. I'm trying to get the information by using getinfo() method that is mention in api documentation. The code i have tried is mentioned below.

   require_once('jsonRPCClient.php');
        $bitcoin = new jsonRPCClient('http://identifier:identiferpass@rpc.blockchain.info:443'); 
 print_r($bitcoin->getinfo());

I have googled it but didn't find the solution. I'm not getting what is the issue in the above code.

I just want to create a hello world connection. Any suggestions will be appreciated. Thank you

user15749

Posted 2014-05-12T11:23:05.457

Reputation: 11

Do you get an error, or just nothing at all? Is the jsonRPCClient.php in the right directory?Mathias711 2014-05-12T12:50:36.887

yes it is in right directory.user15749 2014-05-12T13:27:37.747

the error is : Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to connect to https://identfier:password@rpc.blockchain.info:443 Error: Protocol https not supported or disabled in libcurl' in D:\wamp\www\bitcoin\jsonRPCClient.php on line 231

user15749 2014-05-12T13:28:28.190

and one more : RuntimeException: Unable to connect to https://identifier:identifierpasswrd@rpc.blockchain.info:443 Error: Protocol https not supported or disabled in libcurl in D:\wamp\www\bitcoin\jsonRPCClient.php on line 231

user15749 2014-05-12T13:29:10.153

So it looks like you cant make a connection at all. I found this site, shouldnt you make an account with password?

Mathias711 2014-05-12T13:35:44.773

come again please. there is a password....user15749 2014-05-12T13:48:07.020

Answers

1

You are trying to connect to http over the https port.

For HTTP use:

$bitcoin = new jsonRPCClient('http://identifier:identiferpass@rpc.blockchain.info');

For HTTPS use:

$bitcoin = new jsonRPCClient('https://identifier:identiferpass@rpc.blockchain.info');

According to the blockchain.info documentation both should work.

Maran

Posted 2014-05-12T11:23:05.457

Reputation: 221

1

The error it is giving you tells you that you need a version of libCURL with SSL support. Download the latest version with SSL support from below, open the Zip archive, go in to the "dlls" folder and replace the DLLs in your PHP installation with the new ones. Make sure you download the one which matches the architecture of your PHP installation, not the OS. For instance if you're running the 32 bit version of PHP on a 64 bit version of Windows, you'd want the 32 bit version of libCURL with SSL support.

http://curl.haxx.se/download.html

You might need to restart IIS (or whatever web server you're using) after you replace the DLLs.

Matt

Posted 2014-05-12T11:23:05.457

Reputation: 409