【问题标题】:Gusle Fail in run HTTP RequestGusle 运行 HTTP 请求失败
【发布时间】:2020-11-26 22:55:00
【问题描述】:

我在运行作业时收到此错误:

GuzzleHttp/Exception/RequestException with message 'cURL error 77: error setting certificate verify locations:*emphasized text*
  CAfile: /tmp/curl_haxx_se_ca_cacert_pem.pem
  CApath: /etc/ssl/certs (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)'

请帮帮我

【问题讨论】:

  • 你读过thisthisthis吗?也许你的答案就在里面。到目前为止,您尝试过什么来解决这个问题?

标签: laravel


【解决方案1】:

我找到了这个解决方案:https://github.com/guzzle/guzzle/issues/1935#issuecomment-629548739

使用“验证 => 假”

$client = new Client([
      'base_uri'        => 'https://api.target'
      'verify'          => false, //https://github.com/guzzle/guzzle/issues/1935#issuecomment-629548739
      'headers'         => [
       //Your header here
  ]
]);

如果您使用 http (Illuminate\Support\Facades\Http) https://laravel.com/docs/7.x/http-client#guzzle-options


$response   = Http::withOptions([ //use this method
                'verify'     => false, //This key and value in this method
            ])->withHeaders([
                'Content-Type'  => 'application/json',
                'Accept'        => 'application/json',
            ])->get($url);
return $response;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-07
    • 2014-11-19
    • 1970-01-01
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    • 2015-04-10
    • 2022-10-02
    相关资源
    最近更新 更多