Parse XML with namespace by SimpleXML in PHP

The XML send by outbound message from Salesforce comes with namespace which I cannot parse as most XML tags by SimpleXML.

When google for related solution, it seems children might be the solution, but I cannot find an example that match my case. There are other potential solution like xpath, SoapServer, XML Parser, XMLReader, and even Force.com Toolkit for PHP. But I preferred to keep it simple, and focus on SimpleXML.

After test different combination several times, I finally make it work for my case. Here is how:

Continue reading “Parse XML with namespace by SimpleXML in PHP”