小编vee*_*man的帖子

cURL connect()超时

在过去的几个月里,我的cURL实现成功运行,没有打嗝; 然而,上周我突然开始遇到一个特定网站(www.viewmag.com)的问题.我可以在浏览器中完美地访问该网站(并让它解决),但cURL会返回以下内容:

* About to connect() to www.viewmag.com port 80 (#0)
*   Trying 205.178.145.65... * Timeout
* connect() timed out!
* Closing connection #0
Run Code Online (Sandbox Code Playgroud)

为了理智,我试图用两个不同的盒子ping网站,但每次ping都超时了.

方框1(Linux):

ping www.viewmag.com
PING www.viewmag.com (205.178.145.65) 56(84) bytes of data.
Run Code Online (Sandbox Code Playgroud)

方框2(Windows):

ping www.viewmag.com

Pinging www.viewmag.com [205.178.145.65] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Run Code Online (Sandbox Code Playgroud)

我的cURL如下:

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://www.viewmag.com');
curl_setopt ($ch, CURLOPT_USERAGENT, 'cURL crawler');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt …
Run Code Online (Sandbox Code Playgroud)

php curl ping

2
推荐指数
1
解决办法
4万
查看次数

标签 统计

curl ×1

php ×1

ping ×1