更新时间:2023-12-05 11:10:40
每 curl_exec()
文档:
成功返回TRUE,失败返回FALSE。但是,如果设置了
CURLOPT_RETURNTRANSFER
选项,它将在成功时返回结果,在失败时返回FALSE。
Returns TRUE on success or FALSE on failure. However, if the
CURLOPT_RETURNTRANSFER
option is set, it will return the result on success, FALSE on failure.
您对 var_dump($ content); $ c>的调用显示
bool(false)
,其中表示 curl_exec()
失败。这就是为什么您没有得到任何响应内容的原因。使用 curl_errno()
和/或 curl_error()
找出原因。
Your call to var_dump($content);
is showing bool(false)
, which means curl_exec()
is failing. That is why you are not getting any response content. Use curl_errno()
and/or curl_error()
to find out why it is failing.
我注意到的一件事是 curl_getinfo()
正在报告 [redirect_count] => 20
。这是很多重定向。服务器可能会陷入无限的重定向循环,并且 curl_exec()
决定在一段时间后失败。请参见 CURLOPT_MAXREDIRS
。检查报告的错误号是否为 CURLE_TOO_MANY_REDIRECTS
。
One thing I do notice is curl_getinfo()
is reporting [redirect_count] => 20
. That is a lot of redirects. The server is likely getting stuck in an endless redirect loop and curl_exec()
decides to fail after awhile. See CURLOPT_MAXREDIRS
. Check if the error number being reported is CURLE_TOO_MANY_REDIRECTS
.