问题描述
我在laravel应用程序中的一个函数上遇到此错误。昨天一切正常。
I am getting this error on one function in my laravel application. yesterday everything worked fine.
在CurlFactory.php第187行中的
CurlFactory :: createRejection(object(EasyHandle),array( 'errno'=>
'56','error'=>'SSL读取:error:00000000:lib(0):func(0):reason(0),
errno 104',' url'=>
'',
'content_type'=> null,'http_code'=>'0','header_size' =>'0',
'request_size'=>'1174','filetime'=>'-1','ssl_verify_result'=>
'0','redirect_count'=>'0' ,'total_time'=>'2.30737',
'namelookup_time'=>'0.004516','connect_time'=>'0.02006',
' pretransfer_time'=>'0.06986','size_upload'=>'0','size_download'
=>'0','speed_download'=>'0','speed_upload'=>'0','download_content_length '=>'-1','upload_content_length'=>'-1',
'starttransfer_time'=>'0','redirect_time'=>'0','redirect_url'=>
' ','primary_ip'=> '37 .97.192.223','certinfo'=> array(),
'primary_port'=>'2087','local_ip'=> '10 .0.2.15','local_port'= >
'48858'))在CurlFactory.php第150行中
in CurlFactory.php line 187 at CurlFactory::createRejection(object(EasyHandle), array('errno' => '56', 'error' => 'SSL read: error:00000000:lib(0):func(0):reason(0), errno 104', 'url' => 'https://server7.phasehosting.io:2087/json-api/dumpzone?&domain=phasedev.be', 'content_type' => null, 'http_code' => '0', 'header_size' => '0', 'request_size' => '1174', 'filetime' => '-1', 'ssl_verify_result' => '0', 'redirect_count' => '0', 'total_time' => '2.30737', 'namelookup_time' => '0.004516', 'connect_time' => '0.02006', 'pretransfer_time' => '0.06986', 'size_upload' => '0', 'size_download' => '0', 'speed_download' => '0', 'speed_upload' => '0', 'download_content_length' => '-1', 'upload_content_length' => '-1', 'starttransfer_time' => '0', 'redirect_time' => '0', 'redirect_url' => '', 'primary_ip' => '37.97.192.223', 'certinfo' => array(), 'primary_port' => '2087', 'local_ip' => '10.0.2.15', 'local_port' => '48858')) in CurlFactory.php line 150
当我为API调用指定了错误的参数时得到服务器错误响应,我需要定义正确的参数,当我指定正确的参数时,我得到卷曲错误。
When I specify the wrong parameters for the API call I get a server error response that I need to define the right parameters, when I specify the right parameters I get the Curl error.
使用邮递员发出请求时,我得到成功的响应
When using postman to make the request I get a successfull response
其他API调用确实可以正常工作。所以我现在有点困惑。我应该看哪里?
Other API calls do work as intended. So I'm kind of confused right now. Where should I look?
这是运行查询的函数:
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();
}
}
推荐答案
I经历了这个问题,终于解决了。
在将任何内容压入标题之前,请确保将 echo
压出。您还可以使用 dd($ some_header_variable)
一次查看每个头变量。 要特别注意保存URL值的变量。
就我而言,我遇到的标头变量之一没有解析为正确的值。不幸的是,似乎耗时不对标头进行任何错误处理。
I experienced this problem and finally solved it.Before you push anything into the header, make sure you echo
it out. You can also use dd($some_header_variable)
and eyeball every header variable that you have one at a time. Pay special attention to variables that hold URL values.For my case, one of the header variables I had was not resolving to the correct value. Unfortunately guzzle, seemingly, does not do any error handling on headers.
对于您的情况,首先,尝试尝试 dd($ host)
在浏览器中,并断言显示了 $ host
的预期值。
For your case, first, try to dd($host)
in the browser and assert that the intended value of $host
is displayed.
这篇关于PHP / Laravel:cURL错误56:SSL读取:错误:00000000:lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!