首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为区块链钱包生成新地址

为区块链钱包生成新地址
EN

Stack Overflow用户
提问于 2017-10-20 11:13:58
回答 1查看 754关注 0票数 0

我正在使用块链API为每个钱包生成一个新地址。

以下是代码:

代码语言:javascript
复制
<?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秒的最大执行时间

EN

回答 1

Stack Overflow用户

发布于 2017-10-20 11:23:49

您可能需要这样做:我一直用它来获得新地址。

在提出请求之前,不要忘记启动块链服务。 区块链-钱包-服务启动-端口3000

代码语言:javascript
复制
$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;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46847953

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档