I need to write a PHP page which would accept an XML document sent over a POST request like this:
POST /mypage.php HTTP/1.1 Host: myhost.com Content-Type: ap
You probably want to use the PHP input. Something like
$postText = trim(file_get_contents('php://input'));