PHP Curl HTTPS SSL23_GET_SERVER_HELLO:tlsv1 [英] PHP Curl HTTPS SSL23_GET_SERVER_HELLO:tlsv1

查看:564
本文介绍了PHP Curl HTTPS SSL23_GET_SERVER_HELLO:tlsv1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法通过curl访问https网站,并且被卡住了.

I'm not able to access via curl to a https site and I'm stuck.

可以在浏览器中打开该URL,并且正在使用以下安全连接:

The url can be opened in the browser and is using the following secure connection:

使用 强协议(TLS 1.2),强密钥交换(ECDHE_RSA与 P-256)和强密码(AES_128_GCM).

The connection to this site is encrypted and authenticated using a strong protocol (TLS 1.2), a strong key exchange (ECDHE_RSA with P-256), and a strong cipher (AES_128_GCM).

这是我正在使用的php cUrl脚本:

Here the php cUrl script I'm using:

$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$Org_Input); //$Org_Input
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3'); 
curl_setopt($curl, CURLOPT_AUTOREFERER, true); //updates the referrer
curl_setopt($curl, CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_HEADER, 1);  
curl_setopt($curl, CURLOPT_SSLVERSION, 6);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
$response= curl_exec($curl);
if (FALSE === $response) {
   echo "cUrl Error: " . curl_error($curl) . "<br><br>";
}

该脚本以前与http url一起使用,如果将该URL重定向到https,则现在会引起问题.我相信它链接到curl_setopt($ curl,CURLOPT_SSLVERSION,6);

The script worked previously with the http url and now causes a problem if the url gets redirected to https. I believe it's linked to curl_setopt($curl, CURLOPT_SSLVERSION, 6);

我尝试使用脚本

for($i=0;$i<=6;$i++) {
        //if($i==2) continue;
        $ch = curl_init($Org_Input);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSLVERSION, $i);
        if(curl_exec($ch) === false)
                echo $i.': ' . curl_error($ch) . "<br>";
        else
                echo $i.': works<br>';
        echo "\n";
        curl_close($ch);
}   

我收到以下错误消息:

0:错误:1407742E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本

0: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

1:错误:1409442E:SSL例程:SSL3_READ_BYTES:tlsv1警报协议版本

1: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version

2:与www.example.com:443关联的未知SSL协议错误

2: Unknown SSL protocol error in connection to www.example.com:443

3:错误:14094410:SSL例程:SSL3_READ_BYTES:sslv3警报握手失败

3: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

4:错误:1407742E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本

4: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

5:错误:1407742E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本

5: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

6:错误:1407742E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本

6: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

由于该网站正在使用"TLS 1.2"进行安全连接,因此我相信6是正确的值,因为它代表"CURL_SSLVERSION_TLSv1_2"

As the website is using "TLS 1.2" for secure connection I believe the 6 is the right value as it stands for "CURL_SSLVERSION_TLSv1_2"

但是随后,我陷入了错误响应:"1407742E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本"

But then I'm stuck with the error response: "1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version"

有人知道可能是什么问题?

cUrl版本:7.21.0 Open SSL版本:OpenSSL 0.9.8q 2010年12月2日 openssl版本号:9470239

cUrl Version: 7.21.0 Open SSL version: OpenSSL 0.9.8q 2 Dec 2010 openssl version number: 9470239

推荐答案

OpenSSL 0.9.8q 2010年12月2日

OpenSSL 0.9.8q 2 Dec 2010

此不再受支持的OpenSSL版本不支持现代协议(TLS 1.2)和现代密码.另外,可能是该站点需要TLS SNI扩展,但旧软件可能不支持该扩展.

This no longer supported version of OpenSSL does not support modern protocols (TLS 1.2) and modern ciphers. Additionally it might be that the site requires the TLS SNI extension which maybe is not supported by old software.

由于您访问的站点的URL未知,因此这些问题到底是什么才是真正的问题.但是我很确定这是这些原因之一,并且对其进行OpenSSL,curl和PHP绑定的升级将解决此问题.

It is unknown what exactly of these mentioned problem is really the issue since the URL of the site you reach is unknown. But I'm pretty sure that this is one of these causes and that an upgrade of OpenSSL, curl and the PHP bindings for it will solve the problem.

由于该网站正在使用"TLS 1.2"进行安全连接,因此我相信6是正确的值,因为它代表"CURL_SSLVERSION_TLSv1_2"

As the website is using "TLS 1.2" for secure connection I believe the 6 is the right value as it stands for "CURL_SSLVERSION_TLSv1_2"

由于此版本的OpenSSL不支持TLS 1.2,因此尝试通过此设置使用TLS 1.2不能解决问题,但可能会使情况变得更糟.尝试改用TLS 1.0,因为这是此OpenSSL版本最多可以做的事情.

Since this version of OpenSSL does not support TLS 1.2 trying to use TLS 1.2 using this setting will not solve the problem but maybe make it worse. Try to use TLS 1.0 instead since that is the most this OpenSSL version can do.

这篇关于PHP Curl HTTPS SSL23_GET_SERVER_HELLO:tlsv1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆