钱包配置文件添加配置:重启
listen=1
server=1
daemon=1
rpcuser=lxh
rpcpassword=123456
rpcport=30000
rpcallowip=127.0.0.1
测试请求代码
curl, CURLOPT_URL, 'http://127.0.0.1:30000/');
//设置头文件的信息作为数据流输出
curl_setopt(curl, CURLOPT_USERPWD, "lxh:123456");
//设置获取的信息以文件流的形式返回,而不是直接输出。
curl_setopt(curl, CURLOPT_POST, 1);
//设置post数据
curl, CURLOPT_POSTFIELDS, json_encode(data = curl_exec(curl);
//显示获得的数据
print_r($data);
返回:
{"result":{"blocks":226550,"currentblocksize":0,"currentblocktx":0,"difficulty":3.39278799,"errors":"","genproclimit":-1,"networkhashps":246009815,"pooledtx":1,"testnet":false,"chain":"main","generate":false,"hashespersec":0},"error":null,"id":1}
网友评论