Collegamento * Coin RPC-Server con PHP
Domanda
Cosa dobbiamo scrivere su IP e Porta per connettersi?Voglio usare il mio * Coin-Qt come server RPC.
<?php
require_once 'jsonRPCClient.php';
$coin = new jsonRPCClient('rpcuser:rpcpw123@IP:PORT/');
$json =$coin->getnewaddress();
var_dump($json);
echo "</pre>";
?>
.
Ecco il mio file .conf:
listen=1
maxconnections=32
gen=1
genproclimit=-1
server=1
rpcuser=rpcuser
rpcpassword=rpcpw123
daemon=1
. Soluzione
Se si desidera connettersi all'interno della casella al client Bitcoin, è necessario utilizzare:
<?php
require_once 'jsonRPCClient.php';
$coin = new jsonRPCClient('rpcuser:rpcpw123@localhost:8332/');
$json =$coin->getnewaddress();
var_dump($json);
echo "</pre>";
?>
.
I.e: rpchost= localhost e rpcport= 8332 (porta predefinita per Bitcoin).Per un altro Altcoin, utilizzare la documentazione fornita.
In precedenza è necessario abilitare il RPCServer con queste opzioni nel tuo file Conf.
listen=1
server=1
daemon=1
rpcuser=rpcuser
rpcpassword=rpcpw123
rpcport=8332
rpcallowip=127.0.0.1
. Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow