title: PHP curl is not parsing POST data
body: <p>So i am trying to send a HTTPS POST request to a website but curl is not setting my post data nor my headers.
  Here is my code(i changed the domain and values):</p>
  
  <pre><code>&lt;?php
  
  //Create connection
  $ch = curl_init();
  
  //Set the headers
  $headers = array();
  $headers[] = "Connection: Keep-Alive";
  $headers[] = "Host: website.com";
  $headers[] = "Content-Type: application/x-www-form-urlencoded";
  $headers[] = "Something: Something_Data";
  
  //Set the POST data
  $headers = array();
  $headers[] = "Connection: Keep-Alive";
  $headers[] = "Host: website.com";
  $headers[] = "Content-Type: application/x-www-form-urlencoded";
  $headers[] = "Something: Something_Data";
  
  // Configure the request (HTTPS)
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_URL, "https://website.com/test");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_USERAGENT, "MyUserAgentHere");
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_POST, 1); //just to be sure...
  
  //Set the POST data and Headers
  curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode("DATA1=VAL1&amp;DATA2=VAL2")); 
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
  
  $result=curl_exec($ch);
  echo $result;
  
  curl_close($ch);
  ?&gt;
  </code></pre>
  
  <p>So basically i'm trying to send a HTTPS POST request to <a href="https://website.com/test" rel="nofollow">https://website.com/test</a>". The request is sent and i get an answer but for some reasons it doesn't parse the POST data nor the Headers. </p>
  
  <p>Here is my request in fiddler:</p>
  
  <pre><code>POST https://website.com/test HTTP/1.1
  Host: website.com
  </code></pre>
  
  <p>Here is the answer from the request:</p>
  
  <pre><code>HTTP/1.1 400 Bad Request
  Date: Fri, 06 Nov 2015 00:57:15 GMT
  Server: Apache
  Cache-Control: no-store
  Pragma: no-cache
  Connection: close
  Content-Type: application/json;charset=UTF-8
  Content-Length: 158
  
  {"error":"unsupported DATA1"}
  </code></pre>
  
  <p>As you can see, the POST data and the headers are not set in my request for some reason. I have no idea why curl is not setting my headers and my post fields. </p>
  
  <p>Infos: I am using XAMPP with php5. </p>