Selamlar,
Bir platformum var, bu plarform üzerinde farklı bir sunucuya bağlanıp bir restpoint olarak bir veri almak istiyorum.
Bu işlemi yaparken cURL kullanıyorum fakat aşağıdaki kodu çalıştırdığım zaman aşağıdaki gibi bir openssl hatası alıyorum.
cURL Error: OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0
Bu hatayı nasıl çözebilirim?
<?php
$username = 'kullaniciadi';
$password = 'sifre';
$url = 'https://sunucuadi:8006/api2/json/quarantine/spam';
$ch = curl_init();
$certificate_location = '/etc/apache2/ssl/curl/cacert.pem';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'username' => $username,
'password' => $password
]));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_CAINFO, $certificate_location);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // Zaman aşımı süresi
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'cURL Error: ' . curl_error($ch);
exit;
}
curl_close($ch);
$data = json_decode($response, true);
?>