Author

Topic: JSON RPC API call from webpage (Read 922 times)

hero member
Activity: 882
Merit: 533
January 30, 2017, 10:50:11 AM
#6
change rpcallowip = localhost or 127.0.0.1
you could also add more info to your querry, like the protocol, which is generally http :

Code:
require_once('easybitcoin.php');
        
$bitcoin = new Bitcoin('myusername','mypassword','myip','8332''http');
        
$bitcoin->getinfo();
        
// You can do a small test here
        
$test $bitcoin->getinfo();
        echo 
$test;

?>


.conf :

Code:
listen=1
maxconnections=15
server=1
daemon=1
rpcuser=myusername
rpcpassword=mypassword
rpcclienttimeout=60
rpcport=8332
rpcallowip=localhost or 127.0.0.1 (unless you want to query it from a remote computer, if so, just enter the ip address)

legendary
Activity: 1512
Merit: 1057
SpacePirate.io
January 30, 2017, 09:32:13 AM
#5
Look in your httpd error log file, you should find more information there.

SELinux may be preventing access as well (to port or local files), you may want to check the logs.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Which_Log_File_is_Used.html
newbie
Activity: 21
Merit: 0
January 29, 2017, 01:51:58 AM
#4
You need to log the actual error, probably a setting in PHP so you see what the 'internal error' is, not just that one exists. From there it'll make it a lot easier to find what's going wrong.

The error says

Quote
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
newbie
Activity: 21
Merit: 0
January 29, 2017, 01:09:23 AM
#3
sr. member
Activity: 462
Merit: 250
January 28, 2017, 09:51:02 AM
#2
have you unblock ip or port address?
newbie
Activity: 21
Merit: 0
January 28, 2017, 12:54:46 AM
#1
Hello, 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 https://github.com/aceat64/EasyBitcoin-PHP

I'm trying with this JSON RPC call:

Code:
require_once('easybitcoin.php');
        
$bitcoin = new Bitcoin('myusername','mypassword','myip','8332');
        
$bitcoin->getinfo();
?>


My bitcoin.conf file has:

Code:
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?
Jump to: