PHP curl 未执行错误 524 超时
PHP Curl not executing Error 524 Timeout
Curl 之前在我的服务器上运行良好,但是当我尝试 运行 php 具有 curl_exec
的脚本时,我无法 [=24] =] 脚本。它只是做处理和 returns 524 超时错误。我什至尝试了最简单的 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
上的其他 url
(代表OP发表).
问题出在服务器上。托管服务提供商在我的服务器上阻止了端口 80。我联系了他们并了解了它并要求将其激活。现在一切正常。
Curl 之前在我的服务器上运行良好,但是当我尝试 运行 php 具有 curl_exec
的脚本时,我无法 [=24] =] 脚本。它只是做处理和 returns 524 超时错误。我什至尝试了最简单的 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
(代表OP发表).
问题出在服务器上。托管服务提供商在我的服务器上阻止了端口 80。我联系了他们并了解了它并要求将其激活。现在一切正常。