Reading contents of XML/ARRAY
Posted: Thu Jun 11, 2009 10:37 am
Hi,
I have an array called $xmlresponse and it contains this..
To try and get the value of 'authenticated' from the xml. I am getting an error..
Thanks
I have an array called $xmlresponse and it contains this..
I am using..array(2) { ["xmlresponse"]=> object(SimpleXMLElement)#17 (2) { ["metadata"]=> object(SimpleXMLElement)#18 (1) { ["column"]=> array(4) { [0]=> object(SimpleXMLElement)#20 (1) { ["@attributes"]=> array(2) { ["datatype"]=> string(4) "text" ["name"]=> string(6) "userId" } } [1]=> object(SimpleXMLElement)#21 (1) { ["@attributes"]=> array(2) { ["datatype"]=> string(4) "text" ["name"]=> string(5) "token" } } [2]=> object(SimpleXMLElement)#22 (1) { ["@attributes"]=> array(2) { ["datatype"]=> string(4) "text" ["name"]=> string(13) "authenticated" } } [3]=> object(SimpleXMLElement)#23 (1) { ["@attributes"]=> array(2) { ["datatype"]=> string(4) "text" ["name"]=> string(10) "jsessionid" } } } } ["rows"]=> object(SimpleXMLElement)#19 (1) { ["row"]=> object(SimpleXMLElement)#24 (1) { ["@attributes"]=> array(4) { ["authenticated"]=> string(4) "true" ["jsessionid"]=> string(32) "CAF7D365B6CB63E261B283345BBB3812" ["token"]=> string(32) "p7yPE7zQWWFcYvNI6mD29yHCY7Cb0Bt2" ["userId"]=> string(6) "pleepo" } } } } ["apistring"]=> string(114) "http://192.168.0.42:8081/site-api/login ... ord=pleepo" }
Code: Select all
$testvar = $xmlResult->rows->row['authenticated'];anyone know what im doing wrong?A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: models/dologin.php
Line Number: 21
Thanks