This question already has an answer here:
I have XML-answer, as shown lower.
How to parse correctly this answer by php & SimpleXml? Now I use 'str_replace" to remove strings, such as "soap:Envelope", "simplexml_load_string" and etc. Are there more correct variants for parsing string on to get fields "code" and "message"?
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<example:app_response xmlns:m="urn:QWERTY/YTREWQ/application">
<code>0</code>
<message/>
</example:app_response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope></soap:Body></soap:Envelope>
</div>