You want direct access to the body of a post request, not just the parsed data that PHP puts in $_POST for you. For example, you want to handle an XML document that's been posted as part of a web services request.
Read from the php://input stream, as in Example 8-15.
Reading the post request body
The auto-global array $_POST is great when you just need access to submitted form variables, but it doesn't cut it when you need raw, uncut access to the whole request body. That's where the php://input stream comes in. Read the entire thing with file_get_contents( ), or if you're expecting a large request body, read it in chunks with fread( ).
If the configuration directive always_populate_raw_post_data is on, then raw post data is also put into the global variable $HTTP_RAW_POST_DATA. But to write maximally portable code, you should use php://input instead'that works even when always_populate_raw_post_data is turned off.
8.7.4. See Also
Documentation on php://input at http://www.php.net/wrappers and on always_populate_raw_post_data at http://www.php.net/ini.core#ini.always-populate-raw-post-data.