当我在php中使用curl函数时,我总是会收到此错误:
"无法连接到www.google.de端口80:连接已超时"
如果我在命令行上也这样做:它工作正常......
任何想法为什么?
我的代码:
$ch = curl_init('http://www.google.de');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 1001);
$data = curl_exec($ch);
$curl_errno = curl_errno($ch);
$curl_error = curl_error($ch);
curl_close($ch);
我的php.ini卷曲设置:
cURL support enabled
cURL Information 7.35.0
Age 3
Features
AsynchDNS Yes
CharConv No
Debug No
GSS-Negotiate Yes
IDN Yes
IPv6 Yes
krb4 No
Largefile Yes
libz Yes
NTLM Yes
NTLMWB Yes
SPNEGO No
SSL Yes
SSPI No
TLS-SRP Yes
Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtmp, rtsp, smtp, smtps, telnet, tftp
Host x86_64-pc-linux-gnu
SSL Version OpenSSL/1.0.1f
ZLib Version 1.2.8