How to connect to *coin RPC-Server with PHP

0 votes

What we have to write to IP and port to connect ? I want to use my *coin-qt as a rpc-server.

<?php 
require_once 'jsonRPCClient.php';
$coin = new   jsonRPCClient('rpcuser:rpcpw123@IP:PORT/');
$json =$coin->getnewaddress();        
   var_dump($json);
   echo "</pre>";  
 ?>

Here is my .conf file :

listen=1
maxconnections=32
gen=1
genproclimit=-1
server=1
rpcuser=rpcuser
rpcpassword=rpcpw123
daemon=1
Sep 12, 2018 in Blockchain by digger
• 26,550 points
112 views

1 answer to this question.

0 votes

If you want to connect inside your box to the bitcoin client, then you have to use:

<?php 
   require_once 'jsonRPCClient.php';
   $coin = new   jsonRPCClient('rpcuser:rpcpw123@localhost:8332/');
   $json =$coin->getnewaddress();        
   var_dump($json);
   echo "</pre>";  
 ?>

i.e: rpchost = localhost and rpcport = 8332 (default port for bitcoin). For a different altcoin, use the provided documentation.

You previously have to enable the rpcserver with these options in your conf file.

listen=1
server=1
daemon=1
rpcuser=rpcuser
rpcpassword=rpcpw123
rpcport=8332
rpcallowip=127.0.0.1
answered Sep 12, 2018 by slayer
• 29,170 points

Related Questions In Blockchain

+4 votes
2 answers

I am unable to connect Ganache with Truffle/Npm Dev server. Pls help.

The issue is at CurrentProvider. Give the url ...READ MORE

answered Mar 26, 2018 in Blockchain by Perry
• 17,020 points

edited Oct 11, 2018 by Omkar 353 views
0 votes
1 answer

PHP IPC with geth Ethereum: How to communicate with client?

You have to use PHP Sockets $sock = socket_create(AF_UNIX, ...READ MORE

answered Oct 22, 2018 in Blockchain by Omkar
• 67,660 points
354 views
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
91 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
170 views
0 votes
1 answer
+1 vote
3 answers

How to connect peers to a private network using geth?

Follow the below steps to connect peers ...READ MORE

answered Jul 13, 2018 in Blockchain by slayer
• 29,170 points
1,223 views
0 votes
1 answer

How to solve Yobit API connection 503 server error?

Try to use "https://www.yobit.net/api/3/info" URL Instead of ...READ MORE

answered Aug 21, 2018 in Blockchain by slayer
• 29,170 points
64 views