1

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

Andress Blend
  • 285
  • 2
  • 4
  • 14

3 Answers3

4

Now you can use :

$client = new \GuzzleHttp\Client(['verify' => false ]);
iLoveCode
  • 99
  • 2
  • 8
1

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

episch
  • 388
  • 2
  • 19
  • ok i do this and now have the next ERROR : invalid token format Google\Client.php – Andress Blend Sep 29 '17 at 21:47
  • yes for some APIs you need an API-KEY to get an oauth token. – episch Sep 29 '17 at 21:55
  • but i have an API KEY and CREDENTIALS – Andress Blend Sep 29 '17 at 21:57
  • if you work on a local enviroment you have to get a valid API KEY for this "domain". If localhost (127.0.0.1) isn't set by google for your API key this didn't work. I use this guide and php sdk to get my solution, it works fine for me https://github.com/google/google-api-php-client – episch Sep 29 '17 at 22:00
  • Well... one thing, it would be nice if you mark my answer as correct. Since she helped with your described problem. For the following problem, this topic would also be inappropriate because the error is triggered by something else. – episch Sep 29 '17 at 22:41
1

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.
Zoltán Süle
  • 1,482
  • 19
  • 26