Empty $_POST without Content-type
<p>If I make a POST request where the content-type is not set in the request header, the variable $_POST remains empty.</p>

<p>Question: How can I force PHP to fill $_POST?</p>

<p>I encountered the problem making an Javascript AJAX request using <a href="http://msdn.microsoft.com/en-us/library/cc288060%28v=vs.85%29.aspx" rel="nofollow">XDomainRequest</a> where you can not define any headers. Just to make it easier for you to understand the problem you can simulate the same effect without Javascript in PHP this way:</p>

<pre><code>$data = 'test=1';

$fp = fsockopen('www.yourpage.org', 80, $errno, $errstr, 5);
fputs($fp, "POST /test_out.php HTTP/1.1\r\n");
fputs($fp, "Host: www.yourpage.org\r\n");
//fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ". strlen($data) ."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data);

while(!feof($fp)) { echo fgets($fp, 128); }
fclose($fp);
</code></pre>

<p>test_out.php would be</p>

<pre><code>var_dump($_POST);
</code></pre>

<p>Without the correct content-type the variables in $_POST <em>magically disappear</em>.</p>

<p>This is more an educational question. I am asking this because most people here can not imaging that the content-type has this effect. I was asked to 'come back with facts'. So here you go.</p>
