我的laravel应用程序中的一个函数出现了这个错误。昨天一切都很好。
cURL错误56:SSL读取:错误:00000000:lib(0(:func(0(:原因(0(,错误号104(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html)
在CurlFactory.php第187行CurlFactory::createRejection(对象(EasyHandle(,数组('errno'=>'56','error'=>'SSL读取:错误:00000000:lib(0(:func(0(:原因(0(,errno 104','url'=>'https://server7.phasehosting.io:2087/json-api/dumpzone&domain=phasedev.be','content_type'=>null,'http_code'=>'0','header_size'=>'0',"requestrongize"=>"1174","filetime"=>"-1","ssl_verify_result"=>"0"、"redirect_count"=>"0","total_time"=>"2.30737",'namelookup_time'=>'0.004516','connect_time'=>'0.02006','pre-transfer_time'=>'0.06986','size_upload'=>'0','size_download'=>"0","speed_download"=>"0,"speed_pload"=>"0","download_content_length"=>"-1',"upload_content_ength"=>"-1','starttransfer_time'=>'0','redirect_time'=>'0','redrect_url'=>","primary_ip"=>"37.97.192.223","certinfo"=>array((,'primary_port'=>'2087','local_ip'=>'10.0.215','local_port'=]'488858'((在CurlFactory.php第150行
当我为API调用指定错误的参数时,我会得到一个服务器错误响应,我需要定义正确的参数,当我指定正确的参数时会得到Curl错误。
当使用邮递员提出请求时,我得到了成功的响应
其他API调用按预期工作。所以我现在有点困惑。我应该去哪里看?
这是运行查询的函数:
protected function runQuery($action, $arguments)
{
$host = $this->getHost();
$client = new Client(['base_uri' => $host]);
try{
$response = $client->post('/json-api/' . $action, [
'headers' => $this->createHeader(),
// 'body' => $arguments[0],
'verify' => false,
'query' => $arguments,
'timeout' => $this->getTimeout(),
'connect_timeout' => $this->getConnectionTimeout()
]);
return (string) $response->getBody();
}
catch('GuzzleHttp'Exception'ClientException $e)
{
return $e->getMessage();
}
}
您正在使用哪个版本的Guzzle?确保它不是过时的。Guzzle最近推出了BC问题的版本。
我经历了这个问题,并最终解决了它。在将任何内容推入标头之前,请确保echo
已将其推出。您还可以使用dd($some_header_variable)
,并一次查看您拥有的每个标头变量请特别注意包含URL值的变量对于我的案例,我的一个头变量没有解析为正确的值。不幸的是,guzzle似乎并没有对标题进行任何错误处理。
对于您的情况,首先,尝试在浏览器中使用dd($host)
,并断言显示了$host
的预期值。