DUPLICATE NOTE: This is not IMO a duplicate of this question because I lookaed at that first and did not find an answer to the question there. If you do find it, please let me know exactly where.
In PHP, as we know, the superglobal $_POST[]
is an array that will contain the result of parsing incoming HTTP request body for the mime types of either
- application/x-www-form-urlencoded (standard content type for simple form-posts) or
- multipart/form-data-encoded (mostly used for file uploads)
If our client is sending anything else as a request we need to take care of the parsing ourselves by using the string returned from file_get_contents('php://input');
.
Now here is my question; let's say that I don't know what mimetype my request contains. Can I use $_POST
and php://input
interchangeably? Or to be more specific, will reading from php://input
interfere with the population of $_POST[]
, or will accessing $_POST[]
somehow disrupt or disable php://input
?