我正在使用块链API为每个钱包生成一个新地址。
以下是代码:
<?php
$guid = "7c74bb77-4e25-4eea-a9d3-df1cf6a9d218";
$main_password = "******";
$label = "firsttym";
$json_url = "http://localhost:3000/merchant/$guid/new_address?
password = $main_password & label = $label";
$json_data = file_get_contents($json_url);
$json_feed = json_decode($json_data ,true);
$message = $json_feed->message;
$txid = $json_feed->tx_hash;
?>它总是返回以下警告:
警告: file_get_contents(localhost:3000/merchant/7c74bb77-4e25-4eea-a9d3-df1cf6a9d218/…)函数.文件-获取内容:未能打开流: 连接尝试失败是因为连接方在一段时间后没有正确响应,或者已建立的连接失败是因为连接主机未能响应。 在第8行的C:\wamp\www\block\first.php中 致命错误:在第8行的C:\wamp\www\block\first.php中超过30秒的最大执行时间
发布于 2017-10-20 11:23:49
您可能需要这样做:我一直用它来获得新地址。
在提出请求之前,不要忘记启动块链服务。 区块链-钱包-服务启动-端口3000
$url = "http://localhost:3000/merchant/$guid/new_address?password=$password&label=$label";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$data = json_decode(curl_exec($ch), TRUE);
return $data;https://stackoverflow.com/questions/46847953
复制相似问题