Gusle 运行 HTTP 请求失败
Posted
技术标签:
【中文标题】Gusle 运行 HTTP 请求失败【英文标题】:Gusle Fail in run HTTP Request 【发布时间】: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)'
请帮帮我
【问题讨论】:
你读过this、this或this吗?也许你的答案就在里面。到目前为止,您尝试过什么来解决这个问题? 【参考方案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;
【讨论】:
以上是关于Gusle 运行 HTTP 请求失败的主要内容,如果未能解决你的问题,请参考以下文章