我在SSL_read (https)通过curl提供基于api的顺序数据,但是它返回OpenSSL SSL_read: SSL_ERROR_SYSCALL,errno 104消息。
以下是我的测试代码,根据客户端的要求json:
$apiKey = "xxxxxx-xxxxxx-xxxxx-xxxxxx-xxxxxx";
$privatekey = "xxxxxx-xxxxxx-xxxxx-xxxxxx-xxxxxx";
$timestamp = date('Y-m-d H:i:s'); // (for example: 2016-07-19 14:05:55)
$signature = hash_hmac('sha1', $timestamp, $apiKey);
$signature = hash_hmac('sha1', $privatekey, $signature);
$postURL = "https://www.compu-cover.com/intelligent-rewards/orders/?OrderNo=123";
$orderInfo['Order'] = array(
"apiKey" => $apiKey,
"privatekey" => $privatekey,
"Signature" => $signature,
"Timestamp" => $timestamp,
"Firstname" => "Ajay",
"Surname" => "Sharma",
"EmailAddress" => "ajay@yopmail.com",
"DaytimeTel" => "0141798526",
"EveningTel" => "0141798526",
"MobileTel" => "9887654321",
"Address1" => "A-5",
"Address2" => "Jhalana",
"Address3" => "Jaipur",
"Address4" => "Rajasthan",
"County" => "India",
"Postcode" => "302019",
"Cover" => "ADTBL",
"Scheme" => 2,
"Premium" => 5,
"EquipmentQty" => 1,
"EquipmentType1" => "Smartphone",
"EquipmentMake1" => "Moto",
"EquipmentModel1" => "Moto G",
"EquipmentPrice1" => 100
);
$params = json_encode($orderInfo);
$session = curl_init($postURL);
curl_setopt($session, CURLOPT_POST, true);
curl_setopt($session, CURLOPT_POSTFIELDS, $params);
curl_setopt($session, CURLOPT_HEADER, true);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, true);
$response = curl_exec($session);
if (FALSE === $response) {
var_dump(curl_error($session));
var_dump(curl_errno($session));
}
curl_close($session);
$response = json_decode($response);
var_dump($response);
如何找出失败的原因?失败的原因是什么?请提供您的建议。
发布于 2022-05-17 01:09:54
在标准C库中,变量errno
包含最近一次系统调用出错的代码。104的值被定义为ECONNRESET
,意思是“由对等方重置连接”。
这个错误仅仅意味着对方挂断了你,而没有完成正常的HTTPS协议并返回任何回报.可能出于各种原因,可能是网络问题,或服务器端程序崩溃,或者是另一端根本不喜欢您所做的事情。它与OpenSSL一点关系都没有,要知道是什么引起的,您需要访问服务器日志。
发布于 2019-12-21 05:11:38
可能有很多原因你可能会得到这一点。
对我来说,我得到这个是因为我在使用curl,而我访问的网站不喜欢使用curl。我用以下方法修正了这个问题:
curl -A "Mozilla Chrome Safari" someserver.com/somepage.html
这告诉curl对服务器说,‘嘿,我是个浏览器’。您可以使用您最喜欢的浏览器获得一个更新的字符串,转到浏览器开发人员控制台通常在“网络”下,您可以看到单个请求项,在那里您可以获得当前浏览器作为“用户代理”发送的字符串。
网站之所以会这么做,是因为你的典型客户不使用卷发。最好的情况是使用完服务器资源的机器人,最坏的情况是一个邪恶的黑客。
发布于 2018-03-24 14:45:11
我也有同样的问题。
OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 104
我猜想这个错误被认为是openssl等等,但事实并非如此。
在我的例子中,POST参数之一是错误的值。(类似于OTP代码),我最终解决了它。
https://stackoverflow.com/questions/46195374
复制相似问题