title: Using post request in curl
body: <p>I wrote some lines in php for a post request.
  Trying on firefox the request works but not with curl.</p>
  
  <pre><code>  public function action($key, $file){
         $this-&gt;ch = curl_init();
         $headers[] = "Accept-Encoding: gzip";
         $headers[] = "Connection: Keep-Alive";
         $headers[] = "Content-Type: application/x-www-form-urlencoded";
  
         $datas = "arg=test&amp;action=upload";
         curl_setopt($this-&gt;ch, CURLOPT_URL, "http://test.com");
         curl_setopt($this-&gt;ch, CURLOPT_USERAGENT, $this-&gt;agent);
         curl_setopt($this-&gt;ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($this-&gt;ch, CURLOPT_FOLLOWLOCATION, 1);
         curl_setopt($this-&gt;ch, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($this-&gt;ch, CURLOPT_HTTPHEADER,  $headers);
         curl_setopt($this-&gt;ch, CURLOPT_COOKIEFILE, $this-&gt;cookie_path);
         curl_setopt($this-&gt;ch, CURLOPT_COOKIEJAR, $this-&gt;cookie_path);
         curl_setopt($this-&gt;ch, CURLOPT_POST, TRUE);
         curl_setopt($this-&gt;ch, CURLOPT_POSTFIELDS, $datas);
         curl_setopt($this-&gt;ch, CURLINFO_HEADER_OUT, 1);
  
         $result = json_decode(curl_exec($this-&gt;ch));
         echo curl_error($this-&gt;ch);
         $info = curl_getinfo($this-&gt;ch);
         var_dump($info);
         curl_close($this-&gt;ch);
         var_dump($result);
   }
  </code></pre>
  
  <p>So I have no error but the header of the out is the following :
  GET / HTTP/1.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax), Mozilla Host: test.com Accept: <em>/</em> Connection: Keep-Alive Content-Type: application/x-www-form-urlencoded</p>
  
  <p>Why does the header is using GET and no POST ?
  Could you please help me.</p>
  
  <p>Kind regards</p>