title: Failed cURL POST requests after server change
body: <p>So I have a script to manage game options and it worked quite well a few weeks ago. However, game server changed and my script can't handle POST requests through cURL anymore.</p>
  
  <p>This works fine:</p>
  
  <pre><code>$curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, "http://secura.e-sim.org/donateProducts.html?id=".$player);
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($curl, CURLOPT_ENCODING, "");
  curl_setopt($curl, CURLOPT_HEADER, 1);
  curl_setopt($curl, CURLOPT_FAILONERROR, true);
  curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  curl_setopt($curl, CURLOPT_COOKIEJAR, $_SERVER["DOCUMENT_ROOT"].'/vdod/cookies/'.$_SESSION["operator"].'.txt');
  curl_setopt($curl, CURLOPT_COOKIEFILE, $_SERVER["DOCUMENT_ROOT"].'/vdod/cookies/'.$_SESSION["operator"].'.txt');
  curl_exec($curl);
  </code></pre>
  
  <p>I get desired output. However, the code that goes right after it:</p>
  
  <pre><code>curl_setopt($curl, CURLOPT_URL, "http://secura.e-sim.org/donateProducts.html?id=".$player);
  curl_setopt($curl, CURLOPT_POSTFIELDS, "product=".$fetchSupplies["gift_quality"]."-GIFT&amp;quantity=".$fetchSupplies["gift_amount"]);
  curl_exec($curl);
  </code></pre>
  
  <p>gives me this result:</p>
  
  <pre><code>HTTP/1.1 302 Found Date: Fri, 14 Mar 2014 12:19:41 GMT Server: Apache/2.4.6 (Ubuntu) Location: http://secura.e-sim.org?citizenMessage=UNKNOWN_ERROR Content-Language: en-US Content-Length: 0 Connection: close Content-Type: text/html HTTP/1.1 200 OK Date: Fri, 14 Mar 2014 12:19:41 GMT Server: Apache/2.4.6 (Ubuntu) Content-Language: en-US Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 22927 Connection: close Content-Type: text/html;charset=UTF-8
  </code></pre>
  
  <p>POST request failed. Game sends back the message about an uknown error and I noticed that headers show that Content-Length is... 0.</p>
  
  <p>All variables are correct, I debugged it. </p>
  
  <p>I just don't know how to handle that. How to make POST requests available again.</p>
  
  <p>PS: The thing is, only THIS module is screwed up with POST requests. I can still send automated messages in game (it's using cURL POST as well). Why this particular returns Content-Length: 0?</p>
  
  <p>PS2: Yes, I tried to include</p>
  
  <pre><code>curl_setopt($curl, CURLOPT_POST, 1);
  </code></pre>
  
  <p>and nothing happened.</p>
  
  <p>Help, anybody?</p>