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:


i am aware that is dangerous , i will change it once i can get things working

i am calling json-rpc using this php code

  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 of – George Kimionis Sep 10 '14 at 21:58
  • @GeorgeKimionis That's not it - it's failing with a 403 error, which means that it managed to connect – Nick ODell Sep 10 '14 at 22:49
  • @GeorgeKimionis Whoops, I should clarify. I mean that the first suggestion isn't it. The asker should definitely try the second one. – Nick ODell Sep 10 '14 at 22:57
  • @NickODell we don't really know if it connected to bitcoind, it could be a proxy or even a firewall returning this 403 if packets are filtered. – George Kimionis Sep 11 '14 at 0:14

I just read through the code that handles rpcallowip, and I can tell you that rpcallowip= won't work.

If you want to allow from all addresses, you should use


(Weirdly, I can't find any code that handles wildcards. I'm going to open an issue on github about it. It looks like either the documentation or the code is wrong.)

Edit: It turns out that wildcard support has been removed.

  • so i tried and * , and i get the exact same error, i also tried a random ip address and i got a different error (not 403 but still could not connect)? does that help in any way? – beepbaapboom Sep 10 '14 at 23:44
  • Huh, that's odd. Try setting $btc->debug = true in your program; see if anything enlightening shows up. – Nick ODell Sep 10 '14 at 23:54
  • if i place it after this line: $btc = new jsonRPCClient('ht... that gives me this: "Fatal error: Cannot access private property jsonRPCClient::$debug in C:\Users\Owner\Desktop\USBWebServer\root\php\testrpc.php on line 11" If i change the debug to true in the jsonRPCCLient.php file then it show the same error as the original post :( – beepbaapboom Sep 11 '14 at 0:00
  • @cfxlegion Ah, I misread the code. You should do new jsonRPCClient("http://...", true) – Nick ODell Sep 11 '14 at 0:53
  • i get this, pastebin.com/GGN9WpSK – beepbaapboom Sep 11 '14 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.