loadHTMLFile($index)) { $xpath = new DomXPath($dom); $dates = $xpath->query("//div[h2[text()='Calibration Report']]//p[3]/text()"); $date_string = ""; foreach ($dates as $i => $date) { $date_string = $date->nodeValue; $date_string = substr($date_string, 2); } $users = $xpath->query("//div[h2[text()='Calibration Report']]//p[4]/text()"); $user_string = ""; foreach ($users as $i => $user) { $user_string = $user->nodeValue; $user_string = substr($user_string, 2); } $nodes = $xpath->query("//div[h2[text()='Summary']]//td[5]/text()"); foreach ($nodes as $i => $node) { if ($node->nodeValue == "100%") { $result = "Passed"; } else { $result = "Failed"; } echo "$date_string$result$user_string\n"; } } else { $subdirectories = glob($directory . '/*', GLOB_ONLYDIR); if (count($subdirectories) > 0) { $date_string = substr($base_dir, 0, 4) . "/" . substr($base_dir, 5, 2) . "/" . substr($base_dir, 8, 2) . " " . substr($base_dir, 11, 2) . ":" . substr($base_dir, 14, 2); echo "$date_stringIn Progress\n"; } } }