PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
// The file test.xml contains an XML document with a root element
// and at least an element /[root]/title.
// New York Times RSS feed
$sourcePath = "http://partners.userland.com/nytRss/nytHomepage.xml"
if (file_exists($sourcePath)) {
$xml = simplexml_load_file($sourcePath);
print_r($xml);
} else {
exit('Failed to open test.xml.');
}
?>
I can browse to the URL and I see an XML file. Also if I save the xml file from the URL into the same folder as the php, then the script finds the file and print_r($xml); displays its contents.