【发布时间】:2015-01-27 10:58:59
【问题描述】:
从今天早上开始,我的一个使用 Curl 的脚本出现了问题。错误是“连接到 example.com:443 的未知 SSL 协议错误”。
我尝试强制使用 SSL VERSION 3,但结果是一样的。
curl_setopt($curl, CURLOPT_SSLVERSION,3);
这是我的代码:
$url = "https://example.com/abc/abc";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE );
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_ENCODING, 'UTF-8');
curl_setopt($curl, CURLOPT_SSLVERSION,3);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json2send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$part4 = curl_exec($curl);
我尝试了一个命令,结果是一样的:
curl -I -v --sslv3 https://example.com/abc/abc
* About to connect() to example.com port 443 (#0)
* Trying X.X.X.X...
* connected
* Connected to example.com (X.X.X.X) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* Unknown SSL protocol error in connection to example.com:443
* Closing connection #0
curl: (35) Unknown SSL protocol error in connection to example.com:443
我不知道现在该做什么......或者如何更好地跟踪这个错误
卷曲版
curl 7.26.0 (x86_64-pc-linux-gnu) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
PHP 版本
PHP 5.4.36-0+deb7u3 (cli) (built: Jan 9 2015 08:07:06)
OpenSSL 版本
OpenSSL 1.0.1e 11 Feb 2013
我使用 Curl 7.36 和 7.37 尝试了太多服务器,但遇到了同样的问题。我没有找到解决方案...
谢谢
【问题讨论】:
-
你有什么php版本和curl版本?
-
我编辑了帖子,对不起