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!