PHP script doesn't work with new SSL Certificate
Hi
I followed the procedure indicated at this address (https://bensoftware.com/blog/purchase-ssl-certificate-securityspy/), with the difference that the certificate was generated with the CRL on my synology.
I have a PHP script that will test the state of the cameras and works very well with the default certificate, but no longer returns values with the new certificate. I can not understand why.
The script is as follows:
<?php
$url = "https://IP-SERVER:PORT/++cameramodes?cameraNum=8";
$username = 'user';
$password = 'password';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
$out = curl_exec($ch);
$bad_letters = array("\n"); // à remplacer
$good_letters = array(' '); //en remplacement
$out = str_replace($bad_letters, $good_letters, $out);
print $out;
curl_close($ch);
?>
Have you got an idea about this?
Thanks
I followed the procedure indicated at this address (https://bensoftware.com/blog/purchase-ssl-certificate-securityspy/), with the difference that the certificate was generated with the CRL on my synology.
I have a PHP script that will test the state of the cameras and works very well with the default certificate, but no longer returns values with the new certificate. I can not understand why.
The script is as follows:
<?php
$url = "https://IP-SERVER:PORT/++cameramodes?cameraNum=8";
$username = 'user';
$password = 'password';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
$out = curl_exec($ch);
$bad_letters = array("\n"); // à remplacer
$good_letters = array(' '); //en remplacement
$out = str_replace($bad_letters, $good_letters, $out);
print $out;
curl_close($ch);
?>
Have you got an idea about this?
Thanks
Comments
I found the solution. I've added curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); and now it's works
Thanks