Adil
DevBest CEO
- May 28, 2011
- 1,276
- 714
kso basically, I was reading up on a tutorial, and I created this little xml parser.
All is good and well. However, there is one major flaw, which is the array. The array value (header[0]) would need to be changed manually, every time I want to parse a new header. Is there any way of doing this automatically?
PHP:
<?php
$url = 'clientmsg.xml';
$xml = simplexml_load_file($url);
//get stuff now
$title=$xml->header[0]->title;
$body=$xml->header[0]->body;
$footer=$xml->header[0]->footer;
echo $title . " " . $body . " " .$footer;
?>