Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: madmadmax on April 20, 2013, 04:23:44 PM



Title: PHP connecting to Bitcoin (Solved)
Post by: madmadmax on April 20, 2013, 04:23:44 PM
I am using:

Code:
<?php

 
require_once 'jsonRPCClient.php';
 
  
$client = new jsonRPCClient('http://user:pass@ip:8334/');
  
print_r($client->getinfo());
?>

And getting the error Incorrect response id (request id: 1, response id: ) even though I can connect through my own ip using Google Chrome.

Bitcoind has * in the settings for allow ip at the moment


Title: Re: PHP connecting to Bitcoin
Post by: jon@bitcoinads.com on April 21, 2013, 03:16:29 AM
Can you run the script on the machine running bitcoind to isolate the allowip setting? Maybe this is not the issue if you can connect from Chrome...

I would add a try catch around the block and check out any details of an exception.

try {
   ...
} catch (Exception $e){
   echo $e;
}

Be careful though this might print your connection details...


Title: Re: PHP connecting to Bitcoin
Post by: minzie on April 24, 2013, 10:08:33 PM
I am not sure if you found your solution yet, but it is not clear to me what it is you can connect to using Google Chrome. You are using PHP, so are you trying to run the PHP script from the command line, or from a browser that is not Google Chrome?


Title: Re: PHP connecting to Bitcoin
Post by: scintill on April 24, 2013, 10:19:51 PM
it is not clear to me what it is you can connect to using Google Chrome

I think he's saying if he puts the JSON-RPC HTTP addresses into Chrome, he gets some kind of response showing bitcoind is indeed listening on that IP and port.


Title: Re: PHP connecting to Bitcoin
Post by: madmadmax on April 24, 2013, 11:18:48 PM
Had to sent a message to my host to open the port in the end, thanks for all the help guys.


Title: Re: PHP connecting to Bitcoin
Post by: Xenland on April 25, 2013, 01:49:26 AM
Also you can simplify things by using my library (still in development but i always push out stables releases) http://BitcoinDevKit.com


Title: Re: PHP connecting to Bitcoin
Post by: madmadmax on April 25, 2013, 08:14:30 AM
Also you can simplify things by using my library (still in development but i always push out stables releases) http://BitcoinDevKit.com

10,000$ for something that already exists, amazing.


Title: Re: PHP connecting to Bitcoin
Post by: Xenland on April 25, 2013, 01:34:23 PM
Also you can simplify things by using my library (still in development but i always push out stables releases) http://BitcoinDevKit.com

100,000$ for something that already exists, amazing.

That made no sense


Title: Re: PHP connecting to Bitcoin
Post by: stergium on April 25, 2013, 01:58:17 PM
i am using
rpcallowip=192.168.*.*
rpcport=8332
on conf
and on php part

require_once('jsonRPCClient.php');
$b = new jsonRPCClient('http://user:pass@127.0.0.1:8332/');

i make my calls to api like this
$b->getbalance('*',0);

hope that helps


Title: Re: PHP connecting to Bitcoin
Post by: madmadmax on April 25, 2013, 04:22:58 PM
i am using
rpcallowip=192.168.*.*
rpcport=8332
on conf
and on php part

require_once('jsonRPCClient.php');
$b = new jsonRPCClient('http://user:pass@127.0.0.1:8332/');

i make my calls to api like this
$b->getbalance('*',0);

hope that helps

It's already solved but thanks for the effort, that's what counts  ;)