<p>The Bitcoin wiki is going to a great source for developing your web app. This page describes the process and makes everthing generally less confusing when using PHP.</p>

<p><a href="https://en.bitcoin.it/wiki/PHP_developer_intro" rel="nofollow">PHP Developer Intro</a></p>

<p>You're going to need this <a href="http://jsonrpcphp.org/" rel="nofollow">library</a>. To start you first connect to your node like so, the following should also print out some basic info about your node.</p>

<pre><code>require_once 'jsonRPCClient.php';

$bitcoin = new jsonRPCClient('http://user:password@127.0.0.1:8332/');

echo "&lt;div&gt;\n";

print_r($bitcoin-&gt;getinfo());
echo "&lt;/div&gt;";
</code></pre>

<p>And to do stuff like get a new address:</p>

<pre><code>$sendaddress = $bitcoin-&gt;getnewaddress();
</code></pre>

<p>For other commands check out the <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list" rel="nofollow">API reference</a>.</p>

CC BY-SA 3.0
2014-02-09T01:32:08.657Z
But if I'm just directing newjsonRPCClient() to 127.0.0.1 then how will I put that on an online file? It'll try to execute that on the server?
not anyone
CC BY-SA 3.0
2014-02-09T02:21:38.520Z
PHP is server side, and otherwise interfacing with Bitcoin-qt on the client side would be dangerous. What's stopping me from modifying your website code to empty out the wallet client side would connect to?
John T
CC BY-SA 3.0
2014-02-09T01:04:02.627Z
2014-02-09T01:04:02.627Z
John T
<p>To connect remotely from Bitcoin you should allow the ip of remote host and then you can easily send commands and receive response from your web server for this you need a static IP address. Add the following in your bitcoin configuration file</p>

<pre><code>rpcallowip=ipofremotehost
</code></pre>

<p>if you have bitcoin on windows you should have conf file under %appdata% > roaming > bitcoin</p>

CC BY-SA 3.0
2014-02-09T04:46:44.500Z
2014-02-09T04:46:44.500Z
Khan Shahrukh
<p>I'm pursuing an idea for a web app I had and I've hit a road block. I've worked with many other JSON APIs using php but I've never been introduced to this RPC side of things. I've done reading but still stuck.</p>

<p>I've set up a local bitcoin server using the bitcoin-qt.exe -server command in windows and I've used the resulting console to receive api responses. I'm now confused about how I go about connecting my web app to that server so I can make those calls from my php file and this let users interact with the bitcoin network from the webpage.</p>

<json-rpc><server><php>
Setting up remote bitcoin server control PHP
not anyone
# Setting up remote bitcoin server control PHP

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

I'm pursuing an idea for a web app I had and I've hit a road block. I've worked with many other JSON APIs using php but I've never been introduced to this RPC side of things. I've done reading but still stuck.

I've set up a local bitcoin server using the bitcoin-qt.exe -server command in windows and I've used the resulting console to receive api responses. I'm now confused about how I go about connecting my web app to that server so I can make those calls from my php file and this let users interact with the bitcoin network from the webpage.

**Tags:** json-rpc, server, php


---

## 2 answers

### Answer by username_1 on 2014-02-09. Score: 1

The Bitcoin wiki is going to a great source for developing your web app. This page describes the process and makes everthing generally less confusing when using PHP.

[PHP Developer Intro](https://en.bitcoin.it/wiki/PHP_developer_intro)

You're going to need this [library](http://jsonrpcphp.org/). To start you first connect to your node like so, the following should also print out some basic info about your node.

```
require_once 'jsonRPCClient.php';

$bitcoin = new jsonRPCClient('http://user:password@127.0.0.1:8332/');

echo "<div>\n";

print_r($bitcoin->getinfo());
echo "</div>";

```

And to do stuff like get a new address:

```
$sendaddress = $bitcoin->getnewaddress();

```

For other commands check out the [API reference](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list).

> **Comments:**
> **username_0**: But if I'm just directing newjsonRPCClient() to 127.0.0.1 then how will I put that on an online file? It'll try to execute that on the server?  
> **username_1**: PHP is server side, and otherwise interfacing with Bitcoin-qt on the client side would be dangerous. What's stopping me from modifying your website code to empty out the wallet client side would connect to?  

---

### Answer by username_2 on 2014-02-09. Score: 0

To connect remotely from Bitcoin you should allow the ip of remote host and then you can easily send commands and receive response from your web server for this you need a static IP address. Add the following in your bitcoin configuration file

```
rpcallowip=ipofremotehost

```

if you have bitcoin on windows you should have conf file under %appdata% > roaming > bitcoin


---

