I get XML sent via POST. Naturally, I need to parse this XML to get useful properties for me. However, when I get XML, it seems like PHP parses it as 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>
It becomes (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 that XML is split into the first equal sign (=) in XML into a key / value pair.
How can I avoid this?
source
share