SSL certificate problem: unable to get local issuer certificate

2123 views php
1

I create a php-curl file to akses API from another server:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://192.168.4.2/sdk_service/rest/users/login/v1.1');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// curl_setopt($ch, CURLOPT_CAINFO, "C:/xampp/htdocs/curl/cibinong/cacert.pem");
// curl_setopt($ch, CURLOPT_CAPATH, "C:/xampp/htdocs/curl/cibinong/");
$result = curl_exec($ch);
if (curl_error($ch)) {
    echo curl_error($ch);
}
print_r($result);

I got error message:

SSL certificate problem: unable to get local issuer certificate

Help Me, maybe i miss something?

answered question

@MyNameIs IMO it indeed looks like the question, but the mentioned question does not seem to answer this one also

1 Answer

4

The problem is in the fact that you get an invalid SSL certificate, you need to turn off some checks. Can you try is with the following options?

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

This will skips the verification of the SSL host and SSL peer. Because, that is what you need in this case.

posted this

Have an answer?

JD

Please login first before posting an answer.