With the help of cURL, I am trying to send an xml request to a specific server of a partner company located on a secure server, but with unreliable protection (red line of the browser).

I use code

$curl = curl_init(); $xml = file_get_contents("php://input"); curl_setopt_array($curl, array( CURLOPT_PORT => '8072', CURLOPT_URL => "https://example.ru:8072/xmlinterface.xml", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $xml, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_HTTPHEADER => array( "Content-Type: application/xml", "Authorization: Basic AAAAAAAA" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo $err; } else { echo $response; } 

Despite the fact that the code contains CURLOPT_SSL_VERIFYPEER => FALSE (stopping cURL from verifying the host certificate), an error occurs

Peer certificate cannot be authenticated with known CA certificates

Tell me how to fix the problem

    1 answer 1

    Add another extra

     CURLOPT_SSL_VERIFYHOST => false, 
    • thank. The error was in my code. Now everything is corrected in the question - Zaynab Cat