Guzzle unable to bypass cURL error 35: SSL connect

2019-07-09 03:07发布

问题:

Using Guzzle 6 I am attempting to communicate with an Https endpoint that uses a self-signed certificate.

I am instantiating my Client class as follows:

$authClient = new Client([
    'base_uri' => config('app.auth_uri'),
    'verify' => false
]);

And attempting a request:

$res = $this->authClient->request('POST', '/auth', [
        'form_params' => [
            'client_id' => 'XXXXXXXXXXXXXXX',
            'username' => 'RSA',
            'grant_type' => 'password'
        ]
    ]);

Here is the error I get:

cURL error 35: SSL connect error (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

According to the Guzzle docs I should have done enough to bypass the SSL error.

回答1:

After all that, it turns out my cURL library didn't support the TLS version used by the endpoint. It's a known problem on Centos 6.x servers which my Vagrant box was.

I updated my libcurl with the help of this guide:

Update cURL library on Centos 6