本文介绍了cURL错误(35):错误:14077458:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1无法识别的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用以下代码块通过cURL从HTTPS网站收集数据.

I have been using the following code block to collect data from a HTTPS website using cURL.

$q = 'https://www.example.org/'; // for example
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $q);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

$json = curl_exec($ch);

cURL显示以下错误

cURL shows the following error

error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 unrecognized name

这可能与旧版OpenSSL有关,但是由于网站位于共享托管中,因此目前无法更改服务器端设置.我所能做的就是更改cURL参数.

This might be related to older OpenSSL version, but as the website is in a Shared hosting, server side settings cannot be changed at the moment. All I can do is to change cURL parameters.

我已在此处检查 https://www.ssllabs.com/ssltest/analyze.html 查看该服务器的可用协议,发现SSL3和SSL2不可用,但是TLS 1.2,TLS 1.1和TLS 1.0可用.在Google上搜索时,我发现最好不要指定SSL版本,它实际上会自动协商要使用的最佳级别.虽然,我尝试在CURLOPT_SSLVERSION中设置TLS版本(如下所示),但是会发生相同的错误.

I have checked here https://www.ssllabs.com/ssltest/analyze.html to see the available protocols for that server, found SSL3 and SSL2 is not available, but TLS 1.2, TLS 1.1 and TLS 1.0 are available. Searching over Google, I found its best not specifying SSL version which actually auto-negotiate the best level to use. Although, I tried with setting TLS version in CURLOPT_SSLVERSION (as follows), but same error occurs.

curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);

最近几天我一直在尝试很多,但是所有尝试都是徒劳的.

I have been trying a lot for last few days, but all attempts went in vain.

我试图解释我所做的所有事情,但是任何人请询问是否需要更多信息.任何帮助将不胜感激.

I have tried to explain all the things I did, but anyone please ask if more info needed. Any help would be greatly appreciated.

非常感谢

推荐答案

这可能是cURL#1037错误 http://sourceforge.net/p/curl/bugs/1037/

This might be cURL #1037 Bug http://sourceforge.net/p/curl/bugs/1037/

当您使用过时的openssl 0.9.8 cURL连接到使用openssl 1.0.x的某些服务器并使用SNI时,似乎会发生这种情况.

It seems to happen when you connect with an outdated openssl 0.9.8 cURL against some server with openssl 1.0.x and use SNI.

这篇关于cURL错误(35):错误:14077458:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1无法识别的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:00