2
1
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
Maybe your host is blocking outgoing requests to "non-standard" ports, like 8332? Try 8080 or 443, if they are not reserved by another service. Also try
rpcallowip=*instead of0.0.0.0. – George Kimionis – 2014-09-10T21:58:34.657@GeorgeKimionis That's not it - it's failing with a 403 error, which means that it managed to connect – Nick ODell – 2014-09-10T22:49:32.263
@GeorgeKimionis Whoops, I should clarify. I mean that the first suggestion isn't it. The asker should definitely try the second one. – Nick ODell – 2014-09-10T22:57:26.357
@NickODell we don't really know if it connected to
bitcoind, it could be a proxy or even a firewall returning this403if packets are filtered. – George Kimionis – 2014-09-11T00:14:59.063