how to get multiple XML elements attributes with php simpleXML

snakegaer

New Member
I have this XML\[code\]<STOREITEMS> <CREATED value="http://stackoverflow.com/questions/12801529/Tue Oct 9 5:30:01 BST 2012"> <CATEGORY id="442" name="Hen And Stag Nights"></CATEGORY> <CATEGORY id="69" name="Games"></CATEGORY> <CATEGORY id="252" name="Love Zone"></CATEGORY> <CATEGORY id="202" name="Spotlight Items"></CATEGORY> </CREATED></STOREITEMS>\[/code\]I need to get the Category - name attribute with PHPSo far I have this \[quote\] $xml = simplexml_load_file("http://www.dropshipping.co.uk/catalog/xml_id_multi_info.xml"); foreach($xml->CATEGORY['name']->attributes() as $category)
{
echo $category; }\[/quote\]This however returns Fatal error: Call to a member function attributes() on a non-object Any ideas?Thank you.
 
Back
Top