title: How to send a curl request with pem certificate via PHP?
body: <p>I have a php script in my Apache server that have to send a curl request to a partner's server.
  Partner give me a .pem file that I have to attach to every call I do to its api. </p>
  
  <p>My php script is the follow:</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_SSLCERT, "test.pem" );
  curl_setopt($ch,CURLOPT_SSLCERTTYPE,"PEM");
  
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, True);
  curl_setopt($ch, CURLOPT_POST, True);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
  curl_setopt($ch, CURLOPT_VERBOSE, true);
  
  $result = curl_exec($ch);
  
  if(!$result)
  {
      echo "Curl Error: " . curl_error($ch);
  }
  else
  {
      echo "Success: ". $result;
  }
  
  curl_close($ch);
  </code></pre>
  
  <p>It returns:</p>
  
  <blockquote>
    <p>Curl Error: unable to set private key file: 'test.pem' type PEM</p>
  </blockquote>
  
  <p>Consider that it sends me .pem file and says "it has no passphrase"</p>