我想使用下面的代码来获得PHP Curl工作: 我拥有使用api的域,并且我可以对正在运行的服务器进行任何更改上。PHP curl error 35对等报告遇到内部错误
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
$data = array("username" => "derped", "authid" => "987654321", "ipaddress" => "1.2.3.4", "apikey" => "1234567829");
$data_string = json_encode($data);
$url = 'https://www.somedomain.com/test/api.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: Content-Type: text/html'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
if(curl_exec($ch) === false)
{
echo curl_error($ch);
}
else
{
echo 'ok';
}
curl_close($ch);
$received = json_decode($result);
$check = $received->{'good'};
echo $result;
echo $check;
?>
Curl返回错误:Peer报告它遇到内部错误。 当我卷曲域本身(https://www.somedomain.com)它返回相同的错误。即使当我通过终端使用curl时,它也会返回35错误,但当我试图在不使用HTTPS的情况下卷曲域时,它会返回找到的302,但因为我的域名是https,所以这不是解决方案,它只是回应移动页面。我知道这有些东西用卷曲使用https,但https://www.google.com作品,所以我不知道从哪里开始...
您的证书是否是自签名的?您可能需要将验证器和/或验证主机设置为0 ... –
证书是官方证书(Comodo),我在我的SSL版本中提供了ca。将您的建议添加到它返回的代码后:无法与对等方安全通信:没有常用的加密算法。将检查错误。 – Ecluniam