如何处理通过POST发送的XML?

I'm receiving XML sent via POST. Naturally I need to parse this XML to get at the goodies it holds for me. However, when I receive the XML is seems that PHP is parsing it like a query string.

For example, this xml:

<?xml version="1.0" encoding="utf-8"?>
<ForgotPassword>
    <version>1.0</version>
    <authentication>
        <login>myresllerid</login>
        <apikey>1234567890abcdef</apikey>
    </authentication>
    <parameters>
        <emailAddress>joesmith@example.com</emailAddress>
    </parameters>
</ForgotPassword>

Becomes this (from print_r($_REQUEST)):

Array
(
    [
<?xml_version] => "1.0" encoding="utf-8"?>
<IDCForgotPassword>
    <version>1.0</version>
    <authentication>
        <login>myresllerid</login>
        <apikey>1234567890abcdef</apikey>
    </authentication>
    <parameters>
        <emailAddress>joesmith@example.com</emailAddress>
    </parameters>
</IDCForgotPassword>
)

You can see the XML is being broken up at the first equals sign (=) in the XML into a key/value pair.

How do I avoid this?

Unless enctype is multipart/form-data use php://input to fetch the raw input.

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