Author

Topic: can get jsonRPCClient.php working (Read 1663 times)

sr. member
Activity: 276
Merit: 284
July 23, 2015, 10:55:48 AM
#3
That's normal, you need to have bitcoin running in order to enable RPC.
If you don't need a graphical interface use bitcoind.exe instead (usually servers/websites use this).

jsonRPCClient is just a pretty interface between bitcoin RPC and PHP.

If you don't want to download the blockchain you could use a third party like blockchain, but it's always better to run everything on your own server so you don't have to trust third parties, also if there is any error you are sure that it's something within your own server and not the external service down.

There is also another solution which is using bitcoinJS that connects directly to bitcoin blockchain, but it's a little more painful to setup than RPC.

Glad it worked Smiley
sr. member
Activity: 276
Merit: 284
July 23, 2015, 10:26:14 AM
#2
Hey,

Are you sure the credentials are correct? Usually it wont accept that password.

To make sure delete bitcoin.conf, start bitcoind from command line and it will trow an error complaining about rpc credentials not set and it will generate a password for you.
Copy paste those credentials into a new bitcoin.conf, after that add rpcport=24000 to it and it should work.

bitcoin.conf
Code:
rpcuser=bitcoinrpc
rpcpassword=A7e5RpBX73b6S6HKK7zYQSFCbsE5Fh2FUgftt8gwHvgg
rpcport=24000

test.php
Code:
include "jsonRPCClient.php";
$rpc = new jsonRPCClient("http://bitcoinrpc:[email protected]:24000/");

print_r($rpc->getinfo());
?>

The above should work, at least it works here.

Hope it helps
newbie
Activity: 3
Merit: 0
July 23, 2015, 01:09:52 AM
#1
Hi,

I really hope someone can help me solve this problem. I just want to write some .php code using inputs received from bitcoin api calls but cannot get the JsonRPCClient.php working.

I can run a node (downloaded bitcoin) and can get bitcoin-qt working in the cmd prompt in windows 7;  so it is connecting to the outside world ok.

But I try to run some simple .php on my localhost (using xampp apache engine) and this line of code is not working :

    $bitcoin = new jsonRPCClient('https://bitcoinrpc:[email protected]:8332/');

I get this error :

Warning:  fopen(https://[email protected]:8332/): failed to open stream: No connection could be made because the target machine actively refused it.
 in C:\xampp\htdocs\xampp\jsonRPCClient.php on line 132
Fatal error:  Uncaught exception 'Exception' with message 'Unable to connect to https://bitcoinrpc:[email protected]:8332/' in C:\xampp\htdocs\xampp\jsonRPCClient.php:140
Stack trace:
#0 C:\xampp\htdocs\xampp\hello.php(14): jsonRPCClient->__call('getinfo', Array)
#1 C:\xampp\htdocs\xampp\hello.php(14): jsonRPCClient->getinfo()
#2 {main}
  thrown in C:\xampp\htdocs\xampp\jsonRPCClient.php on line 140

Can,t seem to resolve it.  Have tried various bitcoin.conf configurations, removed my firewall etc.

Any ideas please ?

Jump to: