Bitcoin Forum
November 06, 2024, 11:39:09 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: JSON RPC PHP  (Read 1164 times)
coinableS (OP)
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
December 26, 2015, 08:10:00 AM
 #1

Can't figure out what I'm doing wrong.
I'm trying to access my node running on my computer via my webserver.
Keep getting the same error.

Code:
Fatal error:  Uncaught exception 'Exception' with message 'Incorrect response id (request id: 1, response id: )' in /home/site/public_html/jsonRPCClient.php:152
Stack trace:
#0 /home/site/public_html/node.php(8): jsonRPCClient->__call('getinfo', Array)
#1 /home/site/public_html/node.php(8): jsonRPCClient->getinfo()
#2 {main}
  thrown in /home/site/public_html/jsonRPCClient.php on line 152

I've searched, and have found similar threads with the same error as me, but no clear fix.
Put my webserver as rpcallowip...

my bitcoin.conf
Code:
server=1
rpcuser=userRPC
rpcpassword=passRPC
rpctimeout=30
rpcallowip=68.65.122.148
rpcport=8332

test code
Code:
<?php

  require_once 
'jsonRPCClient.php';
 
  
$btc= new jsonRPCClient('http://userRPC:passRPC@68.105.12.345:8332/');
 
  echo 
"<pre>\n";
  
print_r($btc->getinfo());
  echo 
"</pre>";

?>


Does it matter if I launch bitcoin core, vs bitcoind.exe since I put server=1 in my conf? I've tried launching both, they both do the same thing. I even receive the exact same error if I close my node down, so I'm clearly have an issue connecting.  Bitcoind.exe doesn't do anything, it opens a command window, but there's no text or anything going on to confirm it's working... is that normal?

micaman
Sr. Member
****
Offline Offline

Activity: 345
Merit: 500



View Profile WWW
December 27, 2015, 04:06:53 PM
 #2

If you are running both the node and the webserver on the same machine, you can try to troubleshoot by changing the IPs to 127.0.0.1. If it works you might have port-forwarding issues or forgot to configure them.
You can also just try http://68.105.12.345:8332/ or http://127.0.0.1:8332/ in case you change it, on your browser to test connectivity, if working correctly, it should prompt you with a login form.
MrCrank
Sr. Member
****
Offline Offline

Activity: 1330
Merit: 258



View Profile
July 02, 2017, 02:14:09 PM
 #3

I have issue too.

my code not work and i can't see errors..

where I can download jsonRPCClient.php ?

I checked server error.log:
Code:
PHP Fatal error:  Class 'jsonRPCClient' not found in /var/www/html/index.php on line 4

but I use include_once('jsonRPCClient.php');

Thanks.

 
Euro1000
Full Member
***
Offline Offline

Activity: 209
Merit: 102


View Profile
July 02, 2017, 02:29:17 PM
 #4

Did you already made a test on the RPC conncetion beside using PHP.
In order to test the RPC connection itself you can just send a test message via the Firefox Addin HttpRequester.

There is also curl (a command line tool) but it was not working for me.
micaman
Sr. Member
****
Offline Offline

Activity: 345
Merit: 500



View Profile WWW
July 02, 2017, 02:35:28 PM
 #5

I have issue too.

my code not work and i can't see errors..

where I can download jsonRPCClient.php ?

I checked server error.log:
Code:
PHP Fatal error:  Class 'jsonRPCClient' not found in /var/www/html/index.php on line 4

but I use include_once('jsonRPCClient.php');

Thanks.

 

The link available at https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#PHP doesn't seem to be working.
You can try with EasyBitcoin-PHP available at https://github.com/aceat64/EasyBitcoin-PHP
MrCrank
Sr. Member
****
Offline Offline

Activity: 1330
Merit: 258



View Profile
July 02, 2017, 03:05:48 PM
 #6

The link available at https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#PHP doesn't seem to be working.
You can try with EasyBitcoin-PHP available at https://github.com/aceat64/EasyBitcoin-PHP

I have read it. I thought that my server wrong configuration..
But I don't understand why jsonRPCClient.php not work?

Ok. I try EasyBitcoin-PHP and this is works now.
Thanks!
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!