The XML file we'll use looks something like this:
<?xml version="1.0" encoding="utf-8" ?>
<movies>
<movie>
<title>Star Wars</title>
<year>1977</year>
</movie>
<movie>
<name>Apocalypse Now</name>
<year>1979</year>
</movie>
<movie>
<title>Raiders Of The Lost Ark</title>
<year>1981</year>
</movie>
</movies>
if (!$myxml=simplexml_load_file('mymovies.xml')){
echo 'Error reading the XML file';
}
foreach($myxml as $movie){
echo 'Title: ' . $movie->title . '<br />';
echo 'Year: ' . $movie->year . '<br /><hr />';
}
?>
Friday, April 11, 2008
simple xml
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment