The PHP superglobal $_POST, only is supposed to wrap data that is either.
- application/x-www-form-urlencoded (standard content type for simple form-posts) or
- multipart/form-data (mostly used for file uploads)
If you simply POST a good old HTML form, the request looks something like this:
POST /page.php HTTP/1.1
key1=value1&key2=value2&key3=value3
The server and PHP traditionally don't expect to receive any other content type. In most cases, JSON is the best choice. But a request with a JSON payload would look something like this:
POST /page.php HTTP/1.1
{"key1":"value1","key2":"value2","key3":"value3"}
So php://input returns all the raw data after the HTTP headers of the request, regardless of the content type.
I hope this helps you.