<?php
// The file examples/book.xml contains an XML document with a root element
// and at least an element /[root]/title.
if (file_exists('examples/book.xml')) {
$xml = simplexml_load_file('examples/book.xml');
print_r($xml);
} else {
exit('Failed to open examples/book.xml.');
}
?>
This script will display, on success:
SimpleXMLElement Object
(
[book] => Array
...
)
At this point, you can go about using $xml->title
and any other elements.