Andress Blend
Andress Blend

Reputation: 305

Error GuzzleHttp cURL error 60: SSL certificate

Im trying to use the Google API, however, when I run it it shows me the following error:

GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: u
    nable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl
    -errors.html) in C:\wamp64\www\apigmail\vendor\guzzlehttp\guzzle\src\Handler\Cur
    lFactory.php on line 187

Im using WAMP -Server PHP v 7.0.13

Upvotes: 1

Views: 15455

Answers (3)

iLoveCode
iLoveCode

Reputation: 129

Now you can use :

$client = new \GuzzleHttp\Client(['verify' => false ]);

Upvotes: 7

Zoltán Süle
Zoltán Süle

Reputation: 1694

you have to add \GuzzleHttp\RequestOptions::VERIFY => false to the client config:

$this->client = new \GuzzleHttp\Client([
    'base_uri'                          => 'someAccessPoint',
    \GuzzleHttp\RequestOptions::HEADERS => [
        'User-Agent' => 'some-special-agent',
    ],
    'defaults'                          => [
        \GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => 5,
        \GuzzleHttp\RequestOptions::ALLOW_REDIRECTS => true,
    ],
    \GuzzleHttp\RequestOptions::VERIFY  => false,
]);

it will set CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER in the CurlFactory::applyHandlerOptions() method

$conf[CURLOPT_SSL_VERIFYHOST] = 0;
$conf[CURLOPT_SSL_VERIFYPEER] = false;

From the GuzzleHttp documentation

verify

Describes the SSL certificate verification behavior of a request.

  • Set to true to enable SSL certificate verification and use the default CA bundle > provided by operating system.
  • Set to false to disable certificate verification (this is insecure!).
  • Set to a string to provide the path to a CA bundle to enable verification using a custom certificate.

Upvotes: 1

episch
episch

Reputation: 484

You have to read your error code :) Its simple you have some SSL errors because your localhost enviroment cant get the data, because you didnt have any SSL certificate.

But here is an solution of your problem in an another thread: cURL error 60: SSL certificate: unable to get local issuer certificate

Upvotes: 1

Related Questions