【问题标题】:PHP "Unknown SSL protocol error in connection to" even I forced SSL V3PHP“连接到未知的 SSL 协议错误”,即使我强制使用 SSL V3
【发布时间】: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版本?
  • 我编辑了帖子,对不起

标签: php ssl curl


【解决方案1】:

您尝试连接的服务器可能不支持 SSL(很可能是这种情况)
您是否尝试过改用 TLS 1/1.1/1.2?

另外请发布
openssl version

的输出

【讨论】:

  • 你的意思是我的服务器的 openssl 版本?
  • 您是否正在使用自己的服务器?
  • 是的,我在原帖中添加了我的 openssl 版本
  • 您可以在您的网络浏览器中打开该网站吗?
  • 是的,在 Chrome 中似乎使用了 TLS 1.2
猜你喜欢
  • 1970-01-01
  • 2014-11-29
  • 1970-01-01
  • 1970-01-01
  • 2015-05-17
  • 2013-12-27
  • 1970-01-01
  • 2019-12-15
  • 1970-01-01
相关资源
最近更新 更多