【发布时间】:2020-03-14 23:57:26
【问题描述】:
在我的工作中,我使用 guzzle 调用 api abc.com/test 有时,当有很多工作在申请时。工作失败 cURL 错误 6:无法解析主机:路由器;未知错误(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html) 所有使用 guzzle 的端点都更改为“路由器”。
$config = [
'verify' => false,
'timeout' => 30,
'headers' => ['Content-Type' => 'application/json'],
];
$this->httpClient = new Client($config);
$response = $this->httpClient->request("POST",'abc.com/updateProduct', $data)
【问题讨论】:
-
您能否展示一些有助于了解您在做什么的代码?
-
$config = [ 'verify' => false, 'timeout' => 30, 'headers' => ['Content-Type' => 'application/json'], ]; $this->httpClient = new Client($config); $response = $this->httpClient->request("POST",'abc.com/updateProduct', $data).