Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: lmfsthefounder on January 08, 2014, 10:19:19 PM



Title: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 08, 2014, 10:19:19 PM
I'm sure this is a thousand times old by now, but I just do not understand.

I am getting this error:

"Fatal error:  Uncaught exception 'Exception' with message 'Unable to connect to http://such:trust@66.227.203.224:41337/' in /home/content/61/11420661/html/massivetest/jsonRPCClient.php:140"

(Try it yourself at http://nobanchan.com/massivetest/index.php)

Here is my conf:

server=1
daemon=1
rpcuser=SOMEUSERNAME
rpcpassword=SOMEPASSWORD
rpcallowip=*
rpcport=41337
port=41338
addnode=37.187.93.104
addnode=23.253.71.20
addnode=94.242.254.73
addnode=24.20.187.178
addnode=37.59.31.34
addnode=37.59.54.28
addnode=62.212.72.31

Here is my php:

Code:
<?php require_once 'jsonRPCClient.php';
 
  
$btc= new jsonRPCClient('http://this too:thatone@66.227.203.224:41338/');
 
  echo 
"<pre>\n";
  
print_r($btc->getinfo());
  echo 
"</pre>";
  
  
?>

My ports are forwarded as tcp/ip in my router. WHAT am i doing wrong.

 .005btc bounty for a fix


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: BCB on January 08, 2014, 10:31:08 PM
have you opened those inbound ports on your ec2 security group?


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 08, 2014, 10:31:43 PM
I have NO idea what that is


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 08, 2014, 10:38:35 PM
further reading. this is hosted on my pc; there should be no other firewall here. windows firewall is on, but I even tested with it off.


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: GoldenWings91 on January 08, 2014, 10:42:35 PM
It says trying to connect to port 41338 it should be rpc port 41337

EDIT: It being your test site: http://nobanchan.com/massivetest/index.php (http://nobanchan.com/massivetest/index.php)


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 08, 2014, 10:48:37 PM
changed. still nothin :/


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 08, 2014, 11:05:03 PM
this is absolutely nuts that I can't get this to work


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: GoldenWings91 on January 08, 2014, 11:25:23 PM
I can confirm your client is configured correctly as I can make rpc calls to it.
Try using this curl variant http://pastebin.com/vREuHVr5 (http://pastebin.com/vREuHVr5), if it doesn't work then I'm out of ideas as to why it fails.



Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 08, 2014, 11:35:03 PM
I can confirm your client is configured correctly as I can make rpc calls to it.
Try using this curl variant http://pastebin.com/vREuHVr5 (http://pastebin.com/vREuHVr5), if it doesn't work then I'm out of ideas as to why it fails.

Interesting; connected I think, but have a different error now


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 08, 2014, 11:53:53 PM
Yep here is new error:

Code:

Fatal error:  Uncaught exception 'Exception' with message 'Incorrect response id (request id: 1, response id: )' in /home/content/61/11420661/html/massivetest/jsonRPCClient.php:144
Stack trace:
#0 /home/content/61/11420661/html/massivetest/index.php(6): jsonRPCClient->__call('getinfo', Array)
#1 /home/content/61/11420661/html/massivetest/index.php(6): jsonRPCClient->getinfo()
#2 {main}
  thrown in /home/content/61/11420661/html/massivetest/jsonRPCClient.php on line 144


Now what? lol.
Its like it doesnt like my php request for getinfo?

looks like this:

Code:
<?php require_once 'jsonRPCClient.php';
 
  
$coinye = new jsonRPCClient('http://name:pass@66.227.203.224:41337/');
  
$btc = new jsonRPCClient('http://this:that@66.227.203.224:8332/');
  echo 
"<pre>\n";
  
print_r($coinye->getinfo());
  
//print_r($btc->getinfo());

  
echo "</pre>";
  
  
?>


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: GoldenWings91 on January 09, 2014, 12:04:32 AM
I had no issues connecting before now you changed something and I can't connect either.


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 09, 2014, 12:11:57 AM
I had no issues connecting before now you changed something and I can't connect either.

if you are trying with the passwords i have in the thread, they are the same as before. changed them on screen for security. The passwords are still there. Also, i had closed the client for a moment.

I am connected according to the php exception, just cannot get the data I want.


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: GoldenWings91 on January 09, 2014, 12:16:42 AM
Working for me

Quote
<pre>
Array
(
    [version] => 60400
    [protocolversion] => 60003
    [walletversion] => 60000
    [balance] => 32169.61913646
    [blocks] => 4210
    [connections] => 0
    [proxy] =>
    [difficulty] => 113.33792712
    [testnet] =>
    [keypoololdest] => 1389155877
    [keypoolsize] => 101
    [paytxfee] => 0
    [mininput] => 0.01
    [errors] =>
)
</pre>

Using this code and curl variant for json client
Code:
<?php require_once 'jsonRPCClient.php';
 
  
$btc= new jsonRPCClient('http://user:pass@66.227.203.224:41337/');
 
  echo 
"<pre>\n";
  
print_r($btc->getinfo());
  echo 
"</pre>";
  
?>


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 09, 2014, 12:27:30 AM
are you hosting the jsonRPCClient someplace else or something? because when I pull it from http://nobanchan.com/massivetest/index.php it absolultely does not show me what I want.


This is SO frustrating.  ??? ???


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: amincd on January 09, 2014, 01:13:32 AM
Have you restarted your bitcoind?


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: GoldenWings91 on January 09, 2014, 01:27:14 AM
From the client server type this with correct user name and password into a terminal ( assuming you're using linux )

Code:
curl http://user:pass@66.227.203.224:41337/

you should get this:
Code:
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

Otherwise this:
Code:
curl: (7) couldn't connect to host
which would imply a connection issue, ( wrong user/pass, blocked port, etc )


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: lmfsthefounder on January 09, 2014, 04:36:27 AM
CURL works, but still nothin from the php file


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: predictbits on January 09, 2014, 05:53:21 AM
Allow the client's IP in your firewall on your bitcoind server then in your bitcoind config, set your rpcallowip.


Title: Re: Unable to connect using jsonRPCClient; .005btc bounty for a fix
Post by: Abdussamad on January 09, 2014, 06:28:20 AM
Yep here is new error:

Code:

Fatal error:  Uncaught exception 'Exception' with message 'Incorrect response id (request id: 1, response id: )' in /home/content/61/11420661/html/massivetest/jsonRPCClient.php:144
Stack trace:
#0 /home/content/61/11420661/html/massivetest/index.php(6): jsonRPCClient->__call('getinfo', Array)
#1 /home/content/61/11420661/html/massivetest/index.php(6): jsonRPCClient->getinfo()
#2 {main}
  thrown in /home/content/61/11420661/html/massivetest/jsonRPCClient.php on line 144


This error means that your username or password is incorrect. This is what you should do:

- Edit bitcoin.conf on the server and change the username and password to something that contains only letters and numbers. No special characters or spaces. You can make it really long if you like. Perhaps use openssl rand -hex 32 to get a random password.

- Try with the code below

Code:
<?php require_once 'jsonRPCClient.php';
$btc_username 'yourusername';
$btc_password 'yourpassword';
$btc_ip '66.227.203.224';
$btc_port 41337;

$coinye = new jsonRPCClient"http://$btc_username:$btc_password@$btc_ip:$btc_port/" ) ;

echo 
"<pre>\n";
print_r($coinye->getinfo());
echo 
"</pre>";

?>