I am trying to make a json-call to a VPS server that hosts my wallet and it is failing with the following error message :
Warning: fopen(http://user:pass@ip:port): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
in C:\Users\Owner\Desktop\USBWebServer\root\php\jsonRPCClient.php on line 132
Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://user:pass@ip:port' in C:\Users\Owner\Desktop\USBWebServer\root\php\jsonRPCClient.php:140
Stack trace:
#0 C:\Users\Owner\Desktop\USBWebServer\root\php\testrpc.php(15): jsonRPCClient- >__call('getinfo', Array)
#1 C:\Users\Owner\Desktop\USBWebServer\root\php\testrpc.php(15): jsonRPCClient- >getinfo()
#2 C:\Users\Owner\Desktop\USBWebServer\root\index.php(154): include('C:\Users\Owner\...')
#3 {main}
thrown in C:\Users\Owner\Desktop\USBWebServer\root\php\jsonRPCClient.php on line 140
i got my JsonRPCClinet.php file from here http://jsonrpcphp.org/code.php?file=jsonRPCClient
my bitcoin.conf file is as follows:
server=1
daemon=1
listen=1
rpcuser=user
rpcpassword=pass
rpctimeout=16
rpcallowip=0.0.0.0
rpcport=8332
i am aware that 0.0.0.0 is dangerous , i will change it once i can get things working
i am calling json-rpc using this php code
<?php
require_once 'jsonRPCClient.php';
/* Configuration variables for the JSON-RPC server */
$rpc_host = 'ip';
$rpc_port = '8332';
$rpc_user = 'user';
$rpc_pass = 'pass';
$btc = new jsonRPCClient('http://' . $rpc_user . ':' . $rpc_pass . '@' . $rpc_host . ':' . $rpc_port);
echo "<pre>\n";
print_r($btc->getinfo()); echo "\n";
echo "Received: ".$btc->getreceivedbylabel("BEkpbpYLpwacchSQFRCL7ZSWw3VwB8k7WN")."\n";
echo "</pre>";
?>
additionally i have opened port 8332 on my VPS
can anyone see any reason why this error is occurring, i would greatly appreciate the help
rpcallowip=*
instead of0.0.0.0
.bitcoind
, it could be a proxy or even a firewall returning this403
if packets are filtered.