Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4545890
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:52:36+00:00 2026-05-21T15:52:36+00:00

Aloha everyone, I have another question. I have a SYDI script that retrieves WMI

  • 0

Aloha everyone,

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:

if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != "." && $file != "..") {
                $results[] = $file;
                echo $file . "<br />";
            }
        }
        closedir($dh);      
    }
}

Everything is good and the filenames are returned as shown below:

sydiResult-24-Apr-11-18-59-52.xml
sydiResult-24-Apr-11-19-00-32.xml
sydiResult-24-Apr-11-19-01-17.xml

I’ve tried to use simplexml to call the files, in order, to see if I could even do it, with the following code:

for ($i = 0; $i < sizeof($results); $i++) {
    $xml = simplexml_load_file($results[$i]);
}

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?

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?

Thanks in advance for any and all responses.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:52:36+00:00Added an answer on May 21, 2026 at 3:52 pm

    try this :

    for ($i = 0; $i < sizeof($results); $i++) {
    $file = 'sydiResults/'.$results[$i];
    if (file_exists($file)) {
       $xml = simplexml_load_file($file);
        print_r($xml);
     }
    else {
    exit('Failed to open '.$file);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Aloha, I have a custom control that I need to instantiate from within a
Aloha everyone, I have created a small bash shell script which I wanted to
Aloha, I have a 8MB XML file that I wish to deserialize. I'm using
I have noticed that everyone working with the Canvas object multiply their way around
I have an app that animates the alpha of some images from 0 to
Aloha everyone, I have a background image with a grid layout and would like
Aloha everyone, I have a class assignment in which I am tasked to build
Is there a plugin for Aloha Editor that would let the user add audio/video
I have a process within a network that wants to talk to a service
I have a string Alpha 2 from which I need to extract the integer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.