解决curl: 35 – error:14077410
在某项目中,使用curl请求带ssl身份验证的API时出现了这个问题。
完整的错误信息是:
curl: 35 – error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
度娘了半天也没查出个所以然。
然后莫名其妙的在DA的help中看到了解决办法。
If you’re running curl 7.35.0 and run into this error in php when trying to connect to a remote host:
35 – error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
it means you need to tell curl to use sslv3 and also use the sslv3 ciphers, ensure you have these curl_setopt settings, eg:curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, ‘SSLv3’);
好了,问题解决。
另外,如果是使用GuzzleHttp
可以这样设置
$cfg = [ 'config' => [ 'curl' => [ CURLOPT_SSLVERSION => 3, CURLOPT_SSL_CIPHER_LIST => 'SSLv3' ] ] ]; $client->post('/xxx',$cfg);