Accessing Raw POST via php://input for forms with Content Type multipart/form-data not working
<p>We have a proxy PHP script and access POST form data via</p>

<pre><code>$postPayload = file_get_contents('php://input');
</code></pre>

<p>which usually works.</p>

<p>(The reason to not use <code>$_POST</code> is that we sometimes have duplicate form input names which PHP suppresses)</p>

<p>Now we have a form with</p>

<pre><code>&lt;form name="form" method="post" 
   action="/script.php" enctype="multipart/form-data"&gt;
</code></pre>

<p>In this case <code>file_get_contents('php://input');</code> returns an empty string.</p>

<p>It can be reproduced with</p>

<pre><code>curl 'http://localhost/script.php' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://localhost/script.php?commandCode=NO_AUTH_REGIST_OPEN_USER&amp;amp;lang=de' -H 'Origin: http://misumi-europe.com.orange.imi.local' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36' -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryk3IVneARm3kqJ0fs' --data-binary $'------WebKitFormBoundaryk3IVneARm3kqJ0fs\r\nContent-Disposition: form-data; name="commandCode"\r\n\r\nNO_AUTH_NEXT\r\n------WebKitFormBoundaryk3IVneARm3kqJ0fs\r\n' --compressed
</code></pre>

<p>How can I access the RAW POST data in this case?</p>