我可以使用我的命令行连接到bitcoind并且该进程正在使用相应的端口运行但是当我尝试在使用JSON-RPC库之后通过XAMPP运行它时(我使用PHP开发人员介绍代码)它给了我以下错误,我不知道为什么:
Warning: fopen(): Failed to enable crypto in /opt/lampp/htdocs/bitcoins/jsonRPCClient.php on line 132
Warning: fopen(https://...@127.0.0.1:8332/): failed to open stream: operation failed in /opt/lampp/htdocs/bitcoins/jsonRPCClient.php on line 132
Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to https://user:password
@127.0.0.1:8332/' in /opt/lampp/htdocs/bitcoins/jsonRPCClient.php:140
Stack trace:
#0 /opt/lampp/htdocs/bitcoins/testServer.php(7): jsonRPCClient->__call('getinfo', Array)
#1 /opt/lampp/htdocs/bitcoins/testServer.php(7): jsonRPCClient->getinfo()
#2 {main}
thrown in /opt/lampp/htdocs/bitcoins/jsonRPCClient.php on line 140
代码如下:(我们尝试在http和https之间切换,但仍然无效)
require_once 'jsonRPCClient.php';
$bitcoin = new jsonRPCClient('https://user:password@127.0.0.1:8332/');
echo "<pre>\n";
print_r($bitcoin->getinfo());
echo "</pre>";