adamcol
Newbie
Offline
Activity: 27
Merit: 0
|
 |
January 01, 2014, 05:05:44 PM |
|
Hoping someone has an answer to this rather strange issue. I've got bitcoind running, and connected to my web service via rpc. Commands like this work fine: require_once 'jsonRPCClient.php'; $bitcoin = new jsonRPCClient('http://bitcoinrpc:AJ2sa2cgGh2sVKUBuUCdALCcfNsM2VbLf37pmKEX7X3@99.233.34.168:51337'); $result = $bitcoin->getinfo(); $resulttwo = $bitcoin->getnewaddress("test");
print_r($result);
print_r($resulttwo);
As soon as I use any command that passes two or more arguments, it dies full stop with no errors or anything. Debug.log claims a connection timeout. Eg: require_once 'jsonRPCClient.php'; $bitcoin = new jsonRPCClient('http://bitcoinrpc:AJ2sa2cgGh2sVKUBuUCdALCcfNsM2VbLf37pmKEX7X3@99.233.34.168:51337'); $result = $bitcoin->getinfo(); $resulttwo = $bitcoin->getnewaddress("test"); $resultthree = $bitcoin->getbalance("test", "6");
print_r($result);
print_r($resulttwo);
print_r($resultthree);
I've tried using single quotes, double quotes, no quotes, an array, and a different server.. Any ideas?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Make a difference with your Ether. Donate Ether for the greater good.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
|
|
|
|
|
|
|
|
elbandi
|
 |
January 01, 2014, 05:19:12 PM |
|
catch the exception!
|
|
|
|
|
|
aceat64
|
 |
January 01, 2014, 10:59:50 PM |
|
The jsonRPCClient library uses fopen() and will throw an exception saying "Unable to connect" if it receives a 404 or 500 error from bitcoind. This prevents you from being able to see error messages generated by bitcoind (as they are sent with status 404 or 500). I wrote a replacement for jsonRPCClient specifically for Bitcoin, if you run into any issues with it let me know: https://github.com/aceat64/EasyBitcoin-PHP
|
|
|
|
|
BCB
CTG
VIP
Legendary
Offline
Activity: 1064
Merit: 1000
BCJ
|
 |
January 01, 2014, 11:04:04 PM |
|
adamcol, does event he first of the three cmd's succeed or do they all fail?
|
|
|
|
|
|
aceat64
|
 |
January 05, 2014, 09:48:16 PM |
|
Try using var_dump instead of echo. The output of getinfo() should be an array. $bitcoin = new Bitcoin('bitcoinrpc','AJ2sa2cgGh2sVKUBuUCdALCcfNsM2VbLf37pmKEX7Xh3', '99.233.34.168','51337', 'http'); $bitcoin->full = true; var_dump($bitcoin->getinfo()); var_dump($bitcoin->error);
|
|
|
|
|
gweedo
Legendary
Offline
Activity: 1246
Merit: 1000
Java, PHP, HTML/CSS Programmer for Hire!
|
 |
January 05, 2014, 09:51:38 PM |
|
Did you add allowip=<ip you are connecting from>
in your bitcoin.conf file.
|
|
|
|
gweedo
Legendary
Offline
Activity: 1246
Merit: 1000
Java, PHP, HTML/CSS Programmer for Hire!
|
 |
January 05, 2014, 10:07:23 PM |
|
Try using var_dump instead of echo. The output of getinfo() should be an array. $bitcoin = new Bitcoin('bitcoinrpc','AJ2sa2cgGh2sVKUBuUCdALCcfNsM2VbLf37pmKEX7Xh3', '99.233.34.168','51337', 'http'); $bitcoin->full = true; var_dump($bitcoin->getinfo()); var_dump($bitcoin->error);
Hey - I get a bool(false) with that PHP command. Yes 0 in php means false, when not casted.
|
|
|
|
|
aceat64
|
 |
January 05, 2014, 10:50:38 PM |
|
Do you have the curl extension installed? I haven't tested to see how the script behaves without it.
|
|
|
|
|
|
chiznitz
|
 |
January 09, 2014, 03:46:28 PM |
|
I won't get into my overall issues but I'm having the same issue with easybitcoin.php not placing the error into bitcoin->error.
It returns 0 no matter how I print it.
var_dump($bitcoin2->error); print_r($bitcoin2->error); I broke the address on purpose, when I fix the address it works just fine
the curl dll is installed for php, however I am running on windows during development.
|
|
|
|
|
aceat64
|
 |
January 15, 2014, 12:53:50 AM |
|
I've reworked my library to make more sense and fixed some major bugs. Namely, I wasn't handling things well if cURL ran into an issue. - Errors are now properly handled if cURL runs into a problem (e.g. can't resolve hostname)
- Methods now always return false when they don't work.
- HTTP status codes are available in $this->status
- Human readable error messages are available in $this->error
- Full response is available in $this->response
- Raw response (JSON) is available in $this->raw_response
|
|
|
|
|
|
Shahrukh
|
 |
January 15, 2014, 10:11:59 AM |
|
Did you restart bitcoin daemon after making changes? Nothing will be effected until you restart bitcoind
|
I turned everyone down  Sorry for that
|
|
|
|