Guzzle Curl Error 60 SSL unable to get local issuer

后端 未结 11 1761
刺人心
刺人心 2020-12-14 16:00

Trying to use the YouTube API v3 to get some video(s) information, using Guzzle in Symfony2 using Service Descriptors.

When I run the script, I get this:

相关标签:
11条回答
  • 1) Save the contents of this ca bundle file to your system, eg to: C:/ca-bundle.crt

    2) Update php.ini property openssl.cafile like so: openssl.cafile="C:/ca-bundle.crt"

    3) restart server/ done / should now work

    more info here: http://guzzle.readthedocs.io/en/stable/request-options.html#verify

    0 讨论(0)
  • 2020-12-14 16:42

    It can be that it is looking for the SSL certificate of your site.

    If this is the case, try to disable the SSL certification:

    $client->setDefaultOption('verify', false);
    
    0 讨论(0)
  • 2020-12-14 16:43

    The best option is

    https://github.com/composer/ca-bundle

    $client = new \GuzzleHttp\Client([
        \GuzzleHttp\RequestOptions::VERIFY => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()
    ]);
    
    0 讨论(0)
  • 2020-12-14 16:46

    I use guzzle/guzzle 3.* and this code works for me :

    $client = new Client(env('API_HOST'));
    $client->setSslVerification(false);
    
    0 讨论(0)
  • 2020-12-14 16:47

    If you are using Facades Http then you can pass verify false in withOptions method :

    Http::withOptions(['verify' => false,])->withHeaders($headers)->get($endpoint);

    0 讨论(0)
提交回复
热议问题