4
2
I want to make API calls to my Bitcoin Core wallet from my webpage but when I try to connect it gives me Internal Server Error
I'm using easybitcoin.php JSON from Github.
I'm trying with this JSON RPC call:
require_once('easybitcoin.php');
$bitcoin = new Bitcoin('myusername','mypassword','myip','8332');
$bitcoin->getinfo();
My bitcoin.conf file has:
- listen=1
- maxconnections=15
- server=1
- daemon=1
- rpcuser=myusername
- rpcpassword=mypassword
- rpcclienttimeout=60
- rpcport=8332
- rpcallowip=0.0.0.0/0 (Before I put my IP address here but it didn't solve too)
When I use bitcoin-cli.exe client to send commands to my Bitcoin Core server via 127.0.0.1 (localhost) it works perfectly.
What I'm doing wrong?
Do you mind pasting the error message? – Nick ODell – 2017-01-28T06:36:14.483
For what it's worth, your code works perfectly for me on the
bitcoindhost withmyip=localhostor withmyip=127.0.0.1. It also works from a separate host on local network withmyip=192.168.0.xxprovided I set up my Linux firewallufwto allow connection to port 8332 on thebitcoindhost, and provided I haverpcallowip=0.0.0.0/0on mybitcoindconfig file (and remember to restartbitcoindafter updating config file). I suggest you usevar_dump($bitcoin->getinfo());so you can really see if it is working (you may have failures without exception being thrown returningfalse) – Sven Williamson – 2017-01-28T09:24:34.577