title: ssl certificate in curl
body: <p>I'm trying to find solution for my problem and I found this <a href="https://stackoverflow.com/questions/6400300/https-and-ssl3-get-server-certificatecertificate-verify-failed-ca-is-ok">post</a>.
  I implement it and get this error </p>
  
  <pre><code>cURL Error: SSL certificate problem: self signed certificate
  </code></pre>
  
  <p>This is what I did saving the cacert.pem, I copy and paste it to notepad and put this to my path <strong>C:\xampp\htdocs\test</strong>  and  when I save it, it turns to <strong>cacert.pem.txt</strong>. I don't know if this is the right way to do it. The post said need a PATHTO(which folder cacert.pem save, I think). I put this to php.ini</p>
  
  <pre><code>curl.cainfo = "C:\xampp\htdocs\test\cacert.pem.txt"
  </code></pre>
  
  <p>and this is the code of my curl.</p>
  
  <pre><code>function curl_generator($url,$postData = array()){
  
      if($url){
          $data_string = json_encode($postData);
  
          $ch = curl_init($url);
          //curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
          curl_setopt($ch, CURLOPT_POST, 1);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
          curl_setopt($ch, CURLOPT_HEADER,0);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
          curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 1);
          curl_setopt ($ch, CURLOPT_CAINFO, 'C:\xampp\htdocs\test\cacert.pem.txt');
          curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                  'Content-Type: application/json',
                  'Content-Length: ' . strlen($data_string))
          );
  
          $result = curl_exec($ch);
          if ($result === FALSE) {                
              echo "cURL Error: " . curl_error($ch);  
          }
          curl_close($ch);
  
          return json_decode($result);
      }else{
          return false;
      }
  }
  </code></pre>
  
  <p>I don't know if this is the correct way. I'm now confuse and no idea of error.</p>