title: Simplexml load file from array
body: <p>Aloha everyone,</p>
  
  <p>I have another question.  I have a SYDI script that retrieves WMI data from Windows computers, then appends a timestamp to the end of the file, and finally saves it to a share on a server.  The PHP code I have to read and print out the filenames is shown below:</p>
  
  <pre><code>if (is_dir($dir)) {
      if ($dh = opendir($dir)) {
          while (($file = readdir($dh)) !== false) {
              if ($file != "." &amp;&amp; $file != "..") {
                  $results[] = $file;
                  echo $file . "&lt;br /&gt;";
              }
          }
          closedir($dh);      
      }
  }
  </code></pre>
  
  <p>Everything is good and the filenames are returned as shown below:</p>
  
  <pre><code>sydiResult-24-Apr-11-18-59-52.xml
  sydiResult-24-Apr-11-19-00-32.xml
  sydiResult-24-Apr-11-19-01-17.xml
  </code></pre>
  
  <p>I've tried to use simplexml to call the files, in order, to see if I could even do it, with the following code:</p>
  
  <pre><code>for ($i = 0; $i &lt; sizeof($results); $i++) {
      $xml = simplexml_load_file($results[$i]);
  }
  </code></pre>
  
  <p>but I get errors indicating that simplexml couldn't open external xml files.  The php file is in my htdocs directory, and the xml files are in a directory in the htdocs directory, called sydiResults.  I wanted to separate the sydi xml files, so I decided to make the sub-directory.  Could that be the reason simple xml won't work?  </p>
  
  <p>My plan is simple: open an the xml files and extract certain information from it, then loop to the next xml file, extract certain information from it, then ... so on and so on until I reach the last xml file in the directory. Does anyone have an idea of how I can use simplexml, or if I can use simplexml to open each xml file in turn?</p>
  
  <p>Thanks in advance for any and all responses.</p>