0

I need to send a POST request to the server. The server uses certificates. I have a file with a .p12 extension. This is the first time I come across certificates and do not understand what needs to be done

My code:

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($curl, CURLOPT_CAINFO, ''); // ???
var_dump(curl_exec($curl));
var_dump(curl_error($curl));
curl_close($curl);

As a result, I naturally get the error: bool(false) string(69) "error setting certificate verify locations: CAfile: CApath: none"

But I don't know how to get the path to the certificate from the .p12 file

  • Not sure if https://stackoverflow.com/questions/24363317/curl-cannot-connect-using-p12-certificate gives you more info. Although it's on a slightly different topic. – Nigel Ren Nov 13 '20 at 09:00
  • Try this [guide](https://curl.se/mail/lib-2005-03/0155.html). – Markus Zeller Nov 13 '20 at 10:26

0 Answers0