Php Goutte-TLSv1协议版本错误

Php Goutte-TLSv1协议版本错误,php,curl,ssl,goutte,symfony-components,Php,Curl,Ssl,Goutte,Symfony Components,我使用Goutte在web服务器上使用SSL证书获取页面。每当我尝试获取此页面时,都会引发以下异常: Uncaught exception 'Guzzle\\Http\\Exception\\CurlException' with message '[curl] 35: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version [url] https://somesite.com 我一

我使用Goutte在web服务器上使用SSL证书获取页面。每当我尝试获取此页面时,都会引发以下异常:

Uncaught exception 'Guzzle\\Http\\Exception\\CurlException' with message 
'[curl] 35: error:1407742E:SSL 
routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version 
[url] https://somesite.com 
我一直在网上寻找这类错误。当握手失败时,似乎会发生此错误。服务器似乎支持TLSv1,而客户端使用SSL23

我不确定此评估是否正确,也不知道如何更正。

这是我当前使用的代码:

<?php
use Goutte\Client;
$client = new Client();
$guzzle = $client->getClient();
$guzzle->setConfig( 
    array(
        'curl.CURLOPT_SSL_VERIFYHOST' => false,
        'curl.CURLOPT_SSL_VERIFYPEER' => false,
    )
);

$client->setClient($guzzle);
$crawler = $client->request('GET', 'https://somesite.com'); // IT FAILS HERE

我在博客帖子“”中找到了这个问题的答案

此错误可能发生在某些操作系统中,但并非全部操作系统中,因此很难复制。我目前正在我的开发环境中使用Ubuntu 12.04

谢天谢地,这是可以在代码级别解决的问题,如下所示:

use Goutte\Client;
$client = new Client();
$guzzle = new GuzzleClient('https://somesite.com', array(
    'curl.options' => array(
        'CURLOPT_SSLVERSION' => 'CURL_SSLVERSION_TLSv1',
    )
));
$client->setClient($guzzle);
$crawler = $client->request('GET', 'https://somesite.com');
更新:

获取消息的解决方案

[curl] 35: Unknown SSL protocol error in connection to website.com:443 
由于消息没有显示发生了什么,所以解决起来有点棘手

GitHub问题为我指明了正确的方向。我可以使用多个版本的CURLOPT_SSLVERSION(当然!),但其中包括v1.0、v1.1和v1.2!有关更多信息,请参阅

对于这个特定的错误,我最终使用了以下代码:

$guzzle = new GuzzleClient('https://somesite.com', array(
    'curl.options' => array(
        'CURLOPT_SSLVERSION' => 'CURL_SSLVERSION_TLSv1_1',
    )
));
我试图连接的站点不接受任何其他选项,包括
CURL\u SSLVERSION\u TLSv1

$guzzle = new GuzzleClient('https://somesite.com', array(
    'curl.options' => array(
        'CURLOPT_SSLVERSION' => 'CURL_SSLVERSION_TLSv1_1',
    )
));