PHP: Parse XML
Parse XML via SimpleXML
$xml_string = ""; $xml = simplexml_load_string($xml_string); foreach ($xml->user as $user) { //Get "id" and "status" attributes echo $user['id'].' ('.$user['status'].') John Doe Joanna Doe
'; //Get subnodes echo $user->username. '
'; echo $user->useremail. '
'; }
Tag: PHP, XML, parser, SimpleXML
0 Comments