我收到了这条消息。
无法连接到live.stellar.org端口9002:连接超时
我的代码是,请帮帮我。
$fields = array(
'method' => 'account_tx',
'params' => array(
array(
'account' => 'gPP3hmC86rA8aJiCwRLXRLd9NxGnL2qSwG',
'limit' => '20'
)
)
);
$data = json_encode($fields);
$response = curl_post($data);
function curl_post($fields)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://live.stellar.org:9002");
//curl_setopt($ch, CURLOPT_PORT , 9002);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec ($ch);
echo curl_error($ch);
curl_close ($ch);
return $response;
}
这是Stellar的API代码:
curl -X POST https://live.stellar.org:9002 -d '
{
"method": "account_tx",
"params": [
{
"account": "gPP3hmC86rA8aJiCwRLXRLd9NxGnL2qSwG",
"limit": 4
}
]
}'
一切都很好。
因此,可能性是:
- 也许你的服务器IP在该网站上被禁止
- 也许防火墙阻止您访问此主机/端口
- 也许你需要延长超时时间
请在另一台主机上尝试此代码,或者在本地运行以确保安全。