You want direct access to the body of a 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:
$body = file_get_contents('php://input');
The superglobal array $_POST is designed for accessing submitted HTML 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_con tents(), 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_pop
ulate_raw_post_data is turned off.