0
I’m performing a Curl request with PHP on my hosting. However, if I leave the parameter "CURLOPT_SSL_VERIFYPEER" true, the request returns the error "Curl error 60: SSL Certificate: Unable to get local Issuer Certificate".
But my site is with active ssl and functioning normally.
How do I activate this ssl in the answers of Curl requests in my hosting?
My example Curl Code:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://site.com.br',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $json,
CURLOPT_HTTPHEADER => array(
'Content-Type: text/plain'
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
Have you tried using the -k parameter? Example:
curl https://site.com.br -k
. ref– Danizavtz
It’s probably not who answers that problem, but who makes the requisition. TLS/SSL works based on authority trust, an authority (such as Digicert, Identrust, Globalsign...) signs the key and generates a certificate. Therefore, whoever establishes the connection (your URL) must also trust the same authority, and for that he must know the public keys. In general, this is called "CA-Bundle". It has the public key of all authorities who are trusted (by a somewhat arbitrary criteria). Finally, set up CA-Bundle as mentioned in the previous link (duplicate).
– Inkeliz