我正在使用亚马逊Linux。 Curl适用于大多数网站,但有一个特定的网站根本没有返回任何内容。完全相同的代码在Windows服务器上正常工作
代码是
$url = "https://www.example.com";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_VERBOSE, TRUE);
curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
$result = curl_exec ($curl);
我为显示
的Linux机器启用了verbose
NSS error -12273 (SSL_ERROR_BAD_MAC_READ)
这不会出现在Windows上。
Linux的Curl信息是:
curl
cURL support enabled
cURL Information 7.38.0
Age 3
Features
AsynchDNS Yes
CharConv No
Debug No
GSS-Negotiate No
IDN Yes
IPv6 Yes
krb4 No
Largefile Yes
libz Yes
NTLM Yes
NTLMWB Yes
SPNEGO Yes
SSL Yes
SSPI No
TLS-SRP No
Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host x86_64-redhat-linux-gnu
SSL Version NSS/3.16.2 Basic ECC
ZLib Version 1.2.7
libSSH Version libssh2/1.4.2
并在Windows上:
curl
cURL support enabled
cURL Information 7.30.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 No
SPNEGO Yes
SSL Yes
SSPI Yes
TLS-SRP No
Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host i386-pc-win32
SSL Version OpenSSL/1.0.1e
ZLib Version 1.2.7
libSSH Version libssh2/1.4.2
是否有足够的东西会导致Curl的运作方式有所不同?我认为SSL在某种程度上是罪魁祸首。
谢谢