繁体   English   中英

PHP“连接到未知的SSL协议错误”,即使我强制使用SSL V3

[英]PHP “Unknown SSL protocol error in connection to” even I forced SSL V3

从今天早上开始,我在使用Curl的脚本中遇到一个问题。 该错误是“与example.com:443连接时出现未知SSL协议错误”。

我尝试强制使用SSL版本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的更多服务器上尝试过,并遇到了相同的问题。 我找不到解决方案...

谢谢

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

也请发布输出
openssl version

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM