简体   繁体   中英

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

现在您可以使用:

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM