/ Published in: PHP
                    
                                        
Often PHP can't interpret POST data because it is not form-encoded. This is typical when the post data is XML from API's like Flash's XmlSocket. You can use the following methods to read the POST data directly.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
/**
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
}
/**
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'];
Comments
 Subscribe to comments
                    Subscribe to comments
                
                