title: could not load PEM client certificate, OpenSSL error for calling SOAP services in PHP
body: <p>I have a wsdl API that uses from Certificate to answer. I have a certificate.cer file in base64 format I created a pem file with following commands:</p>
  <pre><code>1- openssl pkcs12 -export -out mycer.pfx -inkey mycer.key -in mercer.cer 
  
  2- openssl pkcs12 -in mycer.pfx -out mycer.pem
  
  </code></pre>
  <p>and I write following code to use it:</p>
  <pre><code>        $curl = curl_init();
          $date = &quot;2021/02/01&quot;;
          curl_setopt_array($curl, array(
              CURLOPT_URL             =&gt; 'url'
              CURLOPT_RETURNTRANSFER  =&gt; true,
              CURLOPT_MAXREDIRS       =&gt; 10,
              CURLOPT_FOLLOWLOCATION  =&gt; true,
              CURLOPT_HTTP_VERSION    =&gt; CURL_HTTP_VERSION_2_0,
              CURLOPT_SSL_VERIFYPEER  =&gt; true,
              CURLOPT_SSLCERT         =&gt; file_get_content(storage_path().'/certs/mycer.pem'),
              CURLOPT_SSLCERTPASSWD   =&gt; '1234',
              CURLOPT_CUSTOMREQUEST   =&gt; 'POST',
              CURLOPT_POSTFIELDS      =&gt; &quot;&lt;x:Envelope xmlns:x=\&quot;http://schemas.xmlsoap.org/soap/envelope/\&quot; xmlns:tem=\&quot;http://tempuri.org/\&quot;&gt;
      &lt;x:Header/&gt;
      &lt;x:Body&gt;
          &lt;tem:GetAccountTransaction&gt;
              &lt;tem:accountNo&gt;123&lt;/tem:accountNo&gt;
              &lt;tem:rowSeqPerDay&gt;0&lt;/tem:rowSeqPerDay&gt;
              &lt;tem:transactionDate&gt;{$date}&lt;/tem:transactionDate&gt;
          &lt;/tem:GetAccountTransaction&gt;
      &lt;/x:Body&gt;
  &lt;/x:Envelope&gt;&quot;,
              CURLOPT_HTTPHEADER =&gt; array(
                  'SOAPAction: http://tempuri.org/IStatementService/GetAccountTransaction',
                  'Content-Type: text/soap+xml; charset=utf-8'
              ),
          ));
  
          $response = curl_exec($curl);
  
          curl_close($curl);
          dd($response , curl_error($curl));
  </code></pre>
  <p>But I get this error:</p>
  <pre><code>&quot;could not load PEM client certificate, OpenSSL error error:02001024:system library:fopen:File name too long, (no key found, wrong pass phrase, or wrong file format?)&quot;
  </code></pre>
  <p>My question is how can I call this special api type?</p>