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>

Categories

Archives

Calendar

May 2018
M T W T F S S
« Jul    
 123456
78910111213
14151617181920
21222324252627
28293031