Accessing POST data

Handling XML requests from PHP involves accessing the raw POST data. This can be done by accessing the $HTTP_RAW_POST_DATA variable, but this depends on having the always_populate_raw_post_data directive enabled in your php.ini. A less memory intensive alternative is php://input, which doesn’t need any special php.ini setting, but it’s not available for multipart/form-data requests.

Reading the whole POST request can be easily done by

$rawdata = file_get_contents('php://input');

Note that php://input can only be read once!

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Categories

Archives

Calendar

February 2012
M T W T F S S
« May    
 12345
6789101112
13141516171819
20212223242526
272829