【问题标题】:PHP Curl not executing Error 524 TimeoutPHP Curl 未执行错误 524 超时
【发布时间】:2016-11-10 10:14:27
【问题描述】:

Curl 以前在我的服务器上运行良好,但是当我尝试运行具有 curl_exec 的 php 脚本时,我无法运行该脚本。它只是进行处理并返回 524 Timeout 错误。我什至尝试过最简单的 curl 代码,但仍然是同样的问题。当我检查我的本地机器时,它工作正常。请帮助我我能做什么。我试过了

<?php 

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "suhailakhtar.xyz");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$fp = fopen('curlerror.log','a');
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_STDERR, $fp);
$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo($result);
}
curl_close ($ch);

?>

在一个简单的 curl 命令上,文件中的错误为

* Rebuilt URL to: suhailakhtar.xyz/
* Hostname was NOT found in DNS cache
* Trying 31.170.164.150...
* connect to 31.170.164.150 port 80 failed: Connection timed out
* Failed to connect to suhailakhtar.xyz port 80: Connection timed out
* Closing connection 0

还有Port 443上的其他网址

【问题讨论】:

    标签: php curl timeout


    【解决方案1】:

    (代表 OP 发布).

    问题出在服务器上。托管服务提供商在我的服务器上阻止了端口 80。我联系了他们并了解了它并要求将其激活。现在一切正常。

    【讨论】:

      猜你喜欢
      • 2022-12-26
      • 1970-01-01
      • 2012-08-05
      • 2012-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-13
      相关资源
      最近更新 更多