PHP script doesn't work with new SSL Certificate
  • Hi

    I followed the procedure indicated at this address (, 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<br />$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;


    Have you got an idea about this?

  • There should be no reason why the new certificate would cause problems, unless it is not set up correctly and therefore SecuritySpy's HTTPS service is no longer working. What happens when you copy and paste that URL into a web browser - do you get the right information back? Or indeed if you just attempt to connect to SecuritySpy's HTTPS service in a web browser - does that work as expected?
  • Hi Ben

    I found the solution. I've added curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); and now it's works :)

  • Great to hear you found the solution. It sounds like the URL you are using in the script is different from the one encoded in the certificate. There is no particular problem with this in your case, so your solution is a good one.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!