<p>I just read through the code that <a href="https://github.com/bitcoin/bitcoin/blob/f7d0a86bf687b4ee11870937666806b289ee9a48/src/netbase.cpp#L1118" rel="noreferrer">handles rpcallowip</a>, and I can tell you that <code>rpcallowip=0.0.0.0</code> won't work.</p>

<p>If you want to allow from all addresses, you should use </p>

<pre><code>rpcallowip=0.0.0.0/0
</code></pre>

<p>(Weirdly, I can't find <em>any</em> 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.)</p>

<p>Edit: It turns out that wildcard support has been removed.</p>

CC BY-SA 3.0
2014-09-10T23:44:58.667Z
so i tried 0.0.0.0/0 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
CC BY-SA 3.0
2014-09-10T23:54:39.007Z
Huh, that's odd. Try setting `$btc->debug = true` in your program; see if anything enlightening shows up.
Nick ODell
CC BY-SA 3.0
2014-09-11T00:00:57.240Z
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
CC BY-SA 3.0
2014-09-11T00:53:17.520Z
@cfxlegion Ah, I misread the code. You should do `new jsonRPCClient("http://...", true)`
Nick ODell
CC BY-SA 3.0
2014-09-11T01:07:23.230Z
i get this, http://pastebin.com/GGN9WpSK
beepbaapboom
CC BY-SA 3.0
2014-09-11T01:11:52.137Z
@cfxlegion By 'http://...' I meant put your actual url there.
Nick ODell
CC BY-SA 3.0
2014-09-11T01:15:29.873Z
i did, thats just what the error gave me lol , for the pastebin i only replaced "user" "pass" and "ip"
beepbaapboom
CC BY-SA 3.0
2014-09-11T01:17:34.470Z
Put the quote before the comma, not after the true. See the example I gave above.
Nick ODell
CC BY-SA 3.0
2014-09-11T01:46:22.223Z
@cfxlegion It's best to not post that kind of info :). So, it's definitely an rpcallowip related error, and the config switch I posted should have fixed it. Did you restart your bitcoin client after changing the config setting?
Nick ODell
CC BY-SA 3.0
2014-09-11T01:58:33.883Z
thanks for the heads up, didn't notice i hadnt remove it, :) okay so you're right, it does seem to be some sort of rpcallowip thing, i just put my computers public ip on the allow list and i got a result for "getinfo" , also got some errors but ill figure it out, but it also means that neither "0.0.0.0/0" or "0.0.0.0" or "*" did what they were supposed to do. hmm
beepbaapboom
CC BY-SA 4.0
2018-08-09T12:27:13.400Z
very important thing missed easily hours spent
Karan
CC BY-SA 4.0
2018-08-23T12:14:59.800Z
thanks! i was already using this property but for some reason nothing was working with my ipv6 ip until setting it to this!
Sonic Soul
CC BY-SA 3.0
2014-09-10T23:21:49.263Z
2015-03-19T20:33:46.773Z
2015-03-19T20:33:46.773Z
Nick ODell
<p>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 :</p>

<pre><code>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- &gt;__call('getinfo', Array)
#1 C:\Users\Owner\Desktop\USBWebServer\root\php\testrpc.php(15): jsonRPCClient-   &gt;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 
</code></pre>

<p>i got my JsonRPCClinet.php file from here <a href="http://jsonrpcphp.org/code.php?file=jsonRPCClient" rel="nofollow">http://jsonrpcphp.org/code.php?file=jsonRPCClient</a></p>

<p>my bitcoin.conf file is as follows:</p>

<pre><code>server=1 
daemon=1
listen=1
rpcuser=user
rpcpassword=pass    
rpctimeout=16
rpcallowip=0.0.0.0
rpcport=8332
</code></pre>

<p>i am aware that 0.0.0.0 is dangerous , i will change it once i can get things working</p>

<p>i am calling json-rpc using this php code</p>

<pre><code>&lt;?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 "&lt;pre&gt;\n";
  print_r($btc-&gt;getinfo()); echo "\n";
  echo "Received: ".$btc-&gt;getreceivedbylabel("BEkpbpYLpwacchSQFRCL7ZSWw3VwB8k7WN")."\n";
  echo "&lt;/pre&gt;";
?&gt; 
</code></pre>

<p>additionally i have opened port 8332 on my VPS</p>

<p>can anyone see any reason why this error is occurring, i would greatly appreciate the help</p>

CC BY-SA 3.0
2014-09-10T22:49:32.263Z
@GeorgeKimionis That's not it - it's failing with a 403 error, which means that it managed to connect
Nick ODell
CC BY-SA 3.0
2014-09-10T22:57:26.357Z
@GeorgeKimionis Whoops, I should clarify. I mean that the first suggestion isn't it. The asker should definitely try the second one.
Nick ODell
<bitcoind><php>
JSON-RPC call to bitcoind error, 403 failed to open stream
beepbaapboom
# JSON-RPC call to bitcoind error, 403 failed to open stream

(Asked by: username_0 on 2014-09-10)

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

**Tags:** bitcoind, php

> **Comments:**
> **username_1**: @GeorgeKimionis That's not it - it's failing with a 403 error, which means that it managed to connect  
> **username_1**: @GeorgeKimionis Whoops, I should clarify. I mean that the first suggestion isn't it. The asker should definitely try the second one.  

---

## 1 answers

### Answer by username_1 on 2014-09-10. Score: 8 | Accepted answer

I just read through the code that [handles rpcallowip](https://github.com/bitcoin/bitcoin/blob/f7d0a86bf687b4ee11870937666806b289ee9a48/src/netbase.cpp#L1118), and I can tell you that `rpcallowip=0.0.0.0` won't work.

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

```
rpcallowip=0.0.0.0/0

```

(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.

> **Comments:**
> **username_0**: so i tried 0.0.0.0/0 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?  
> **username_1**: Huh, that's odd. Try setting `$btc->debug = true` in your program; see if anything enlightening shows up.  
> **username_0**: 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   :(  
> **username_1**: @cfxlegion Ah, I misread the code. You should do `new jsonRPCClient("http://...", true)`  
> **username_0**: i get this, http://pastebin.com/GGN9WpSK  
> **username_1**: @cfxlegion By 'http://...' I meant put your actual url there.  
> **username_0**: i did, thats just what the error gave me lol , for the pastebin i only replaced "user" "pass" and "ip"  
> **username_1**: Put the quote before the comma, not after the true. See the example I gave above.  
> **username_1**: @cfxlegion It's best to not post that kind of info :). So, it's definitely an rpcallowip related error, and the config switch I posted should have fixed it. Did you restart your bitcoin client after changing the config setting?  
> **username_0**: thanks for the heads up, didn't notice i hadnt remove it, :) okay so you're right, it does seem to be some sort of rpcallowip thing, i just put my computers public ip on the allow list and i got a result for "getinfo" , also got some errors but ill figure it out, but it also means that neither "0.0.0.0/0" or "0.0.0.0" or "*" did what they were supposed to do. hmm  
> **username_2**: very important thing missed easily hours spent  
> **username_3**: thanks! i was already using this property but for some reason nothing was working with my ipv6 ip until setting it to this!  

---

