![](/img/trans.png)
[英]Curl error: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
[英]PHP Soap issue: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 or SSL: Connection reset by peer
我嘗試執行 SOAP 請求,
Could not get any response
錯誤SoapClient::__doRequest(): SSL: Connection reset by peer
errorOpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
錯誤一切就緒,在沒有 wsdl 模式和不同的 ssl 驗證選項下嘗試 SoapClient,並在遠程服務器上嘗試,所以不是互聯網連接問題。
這是第 3 點的代碼:
$this->client = new \SoapClient($this->wsdl, [
'soap_version' => SOAP_1_1,
'exceptions' => true,
'trace' => true,
'cache_wsdl' => WSDL_CACHE_NONE,
]);
$response = $this->client->__doRequest(trim($xml), $url, 'getReport', SOAP_1_1);
這是第 4 點的代碼:
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); // both 0 & 1 not works
curl_setopt($ch, CURLOPT_URL, $location);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); // also tries different values
curl_setopt($ch, CURLOPT_TIMEOUT, 15); // here too
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, trim($request));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1); // also not works without this
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // and this
$response = curl_exec($ch);
我能做些什么來更深入地調試這個問題並解決它?
事實證明,header 值SOAPAction
需要在額外的轉義引號中,如下所示:
$headers = [
"SOAPAction: \"http://example-url.com\"",
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.