Post
Topic
Board Bitcoin Technical Support
Topic OP
Help with blockchain.info JSON RPC API??
by
BiTCoinRC
on 09/05/2013, 21:10:43 UTC
Hi,

I have opened a blockchain.info wallet in the hope of using their JSON RPC API for a website project, and am trying to use code below to show the balance of the wallet on my website to test the water.

Code:

/* Configuration variables for the JSON-RPC server */
$rpc_host 'rpc.blockchain.info';
$rpc_port '80';
$rpc_user 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
$rpc_pass 'PASSWORD';


require_once(
'jsonRPCClient.php');
$bc = new jsonRPCClient('http://' $rpc_user ':' $rpc_pass '@' $rpc_host ':' $rpc_port);

$balance $bc->getbalance();

?>

However I get these errors:

Code:
Warning: fopen(http://...@rpc.blockchain.info:80) [function.fopen]: failed to open stream: operation failed in /home/*****/public_html/*****/jsonRPCClient.php on line 132

Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:PASSWORD@rpc.blockchain.info:80' in /home/a*****/public_html/*****/jsonRPCClient.php:140 Stack trace: #0 /home/*****/public_html/*****/index.php(18): jsonRPCClient->__call('getbalance', Array) #1 /home/*****/public_html/*****/index.php(18): jsonRPCClient->getbalance() #2 {main} thrown in /home/*****/public_html/*****/jsonRPCClient.php on line 140

Does anybody have any idea what I am doing wrong?

EDIT SOLVED: I was using a strong password with various symbols (*#; etc..) in for the blockchain wallet and it did not seem to like this.