繁体   English   中英

错误28超时! PHP

[英]Error 28 timed out! PHP

我正在尝试将信息添加到特定端口号的其余Web服务:8999.在localhost上,它工作正常,但在实时服务器上,它给出以下错误:

cURL错误(28):connect()超时!

这是代码

$ch = curl_init('http://int.otono-me.com:8999/api/customers/new'); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);                                                                     
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 50); 
curl_setopt($ch, CURLOPT_PORT, 8999);                                                                     
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    "Content-Type: application/json",                                                                                
    "X-Auth-Token: " . $_SESSION["Token"]
));                                                                                                                   

$result = curl_exec($ch);
$curl_errno = curl_errno($ch);
$curl_error = curl_error($ch);
if($curl_errno > 0) {
    echo "cURL Error ($curl_errno): $curl_error\n";
} else {
    echo "Successful\n";
}
curl_close($ch);

echo $result;

关于需要做什么的任何建议?

您可以在实时系统上使用代理,也可以在两者之间使用防火墙。

询问您当地的sysop有关防火墙的更改。

你也错过了'

$ch = curl_init('http://int.otono-me.com:8999/api/customers/new'); 
//       -------^
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://int.otono-me.com:8999/api/customers/new");

你的链接也没有回答

不要在您的URL中实现您的PORT。 单独发送URL和PORT:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://int.otono-me.com/api/customers/new");
curl_setopt($ch, CURLOPT_PORT, 8999);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM