<p>I would definitely not do it this way and use a RPC client. A very simple one is <a href="https://github.com/aceat64/EasyBitcoin-PHP" rel="nofollow noreferrer">https://github.com/aceat64/EasyBitcoin-PHP</a></p>

CC BY-SA 3.0
2017-01-19T11:37:14.240Z
2017-01-19T11:37:14.240Z
Alex
<p>You have a couple of approaches:</p>

<ol>
<li>Use some well written JSON/RPC php client like this <a href="https://github.com/datto/php-json-rpc-http" rel="nofollow noreferrer">php-json-rpc-http</a> [For using via HTTPS] or <a href="https://github.com/datto/php-json-rpc-ssh" rel="nofollow noreferrer">php-json-rpc-ssh</a> [For using via SSH] along with implementing calls on your own based on <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list" rel="nofollow noreferrer">Bitcoin's Reference API CallsList</a>. <a href="https://bitcoin.org/en/developer-reference#rpc-quick-reference" rel="nofollow noreferrer">Bitcoin RPC quick reference</a> is also very helpful.</li>
<li>Completely rely on <a href="https://github.com/denpamusic/php-bitcoinrpc" rel="nofollow noreferrer">PHP-BitconRPC</a>, which is a well unit-tested all-in-one library using Guzzle</li>
</ol>

CC BY-SA 4.0
2019-02-25T15:08:00.207Z
2019-02-25T15:56:53.380Z
2019-02-25T15:56:53.380Z
behkod
<p>i installed a bitcoind core and i access bitcoin-cli command in linux terminal with developer command(getbalance, getaccountaddress etc.) but i want run this command in php file.</p>

<p>my php code is:</p>

<pre><code>chdir('/home/itr/Downloads/bitcoin/bin');
$output = shell_exec("./bitcoin-cli getbalance");
echo var_dump($output); 
</code></pre>

<p>bitcoin-cli file path:</p>

<blockquote>
  <p>/home/itr/Downloads/bitcoin/bin</p>
</blockquote>

<p>please tell me what i do?</p>

<bitcoind><bitcoin-core><client>
How To connect BItcoin Core with Php
Mohammad Asif
# How To connect BItcoin Core with Php

(Asked by: username_0 on 2017-01-19)

i installed a bitcoind core and i access bitcoin-cli command in linux terminal with developer command(getbalance, getaccountaddress etc.) but i want run this command in php file.

my php code is:

```
chdir('/home/itr/Downloads/bitcoin/bin');
$output = shell_exec("./bitcoin-cli getbalance");
echo var_dump($output); 

```

bitcoin-cli file path:

> /home/itr/Downloads/bitcoin/bin

please tell me what i do?

**Tags:** bitcoind, bitcoin-core, client


---

## 2 answers

### Answer by username_1 on 2017-01-19. Score: 3

I would definitely not do it this way and use a RPC client. A very simple one is <https://github.com/aceat64/EasyBitcoin-PHP>


---

### Answer by username_2 on 2019-02-25. Score: 0

You have a couple of approaches:

1. Use some well written JSON/RPC php client like this [php-json-rpc-http](https://github.com/datto/php-json-rpc-http) [For using via HTTPS] or [php-json-rpc-ssh](https://github.com/datto/php-json-rpc-ssh) [For using via SSH] along with implementing calls on your own based on [Bitcoin's Reference API CallsList](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list). [Bitcoin RPC quick reference](https://bitcoin.org/en/developer-reference#rpc-quick-reference) is also very helpful.
2. Completely rely on [PHP-BitconRPC](https://github.com/denpamusic/php-bitcoinrpc), which is a well unit-tested all-in-one library using Guzzle


---

