I have XML in PHP, I am trying to get the value of the status node:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<result>
<form name="MREP">
<update>
<criteria>
<field name="Serial_Number" compOperator="Equals" value="A-000-1012"></field>
<reloperator>AND</reloperator>
<field name="MREP_Type" compOperator="Equals" value="0"></field>
</criteria>
<newvalues>
<field name="Is_being_Used">
<value><![CDATA[TRUE]]></value>
</field>
</newvalues>
<status>Success</status>
</update>
</form>
</result>
</response>
I tried
$xml = simplexml_load_string($mrepValide);
echo $xml->status;
(where $mrepValide is a string of XML shown above)
But I think it didnt work since status is not the parent node. Any help would be greatly appreciated.
The document structure is:
So you must properly navigate it, like:
http://codepad.viper-7.com/lQxOoF
Take the time to familiarise yourself with Basic SimpleXML Usage, which shows you how to move around in and work with SimpleXML objects.