SIMPLEXML_LOAD_FILE ERROR - help please

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!

Moderator: General Moderators

Post Reply
nmpku
Forum Newbie
Posts: 11
Joined: Wed Oct 05, 2005 12:42 am

SIMPLEXML_LOAD_FILE ERROR - help please

Post by nmpku »

Below is my code. Everytime I run this, it gives me an error of "Bool False." Can anyone see anything wrong?

Code: Select all

 
$directory = '/path/to/directory/';
 
if ($handle = opendir($directory)) {
    echo "Directory handle: $handle\n";
    echo "Files:\n";
 
 //* This is the correct way to loop over the directory. */
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
 
//* Loop through each ad             
 
        foreach ($file as $ad); {
            $xml = simplexml_load_file("$directory$file");
            var_dump($xml);
 
            }
        }
    }
 
    closedir($handle);
 
} 
 
Post Reply