/**
Using php://input
-----------------
Version: 4.3+
Reading [php://input][1] is the preferred method since PHP 4.3.
The Content-Type header of the posted content must _NOT_ be
application/x-www.form-urlencoded or multipart/form-data.
For XML you can use the Content-Type: text/xml.
[1]: http://us2.php.net/manual/en/wrappers.php.php
*/
// Make sure the user is posting
if ( $_SERVER['REQUEST_METHOD'] === 'POST' )
{
// Read the input from stdin
$postText = trim(file_get_contents('php://input'));
}
/**
Using $HTTP_RAW_POST_DATA
-------------------------
Version 3.0+
__Note__: Reading php://input is preferred.
As with php://input, the Content-Type header of the
posted content must _NOT_ be application/x-www.form-urlencoded or
multipart/form-data.
PHP 4.1+
~~~~~~~~
You can also enable [always-populate-raw-post-data][1] in the php.ini to
have the value always populated reguardless of Content-Type. However
since this requires config changes it is less portable.
[1]: http://us2.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data
*/
$postText = $GLOBALS['HTTP_RAW_POST_DATA'];