![]() |
trying to get xml value from array - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: trying to get xml value from array (/showthread.php?tid=19573) |
trying to get xml value from array - El Forum - 06-11-2009 [eluser]rossmurphy[/eluser] Hi, I have an array called $xmlresponse and it contains this.. Quote: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.action?siteId=SITE&key=abc&sessionId=6900635&userId=pleepo&password=pleepo" } I am using.. Code: $testvar = $xmlResult->rows->row['authenticated']; To try and get the value of 'authenticated' from the xml. I am getting an error.. Quote:A PHP Error was encountered anyone know what im doing wrong? Thanks trying to get xml value from array - El Forum - 06-11-2009 [eluser]gtech[/eluser] . trying to get xml value from array - El Forum - 06-11-2009 [eluser]rossmurphy[/eluser] You posted a blank.. trying to get xml value from array - El Forum - 06-11-2009 [eluser]gtech[/eluser] this is how I read it Code: $xmlresult['xmlresponse']->rows->row['authenticated']; trying to get xml value from array - El Forum - 06-11-2009 [eluser]rossmurphy[/eluser] Thanks, i got it using Code: $xmlResult->rows->row['authenticated'] ![]() trying to get xml value from array - El Forum - 06-11-2009 [eluser]gtech[/eluser] lol ok.. I think ive been staring at code far to long... Im going to take a break, as a matter of interest whats the difference between that and your original code you posted? |