connect(); $data = $router->send_command($query, $parameters); $router->disconnect(); // Process the output line by line foreach (preg_split("/((\r?\n)|(\r\n?))/", $data) as $line) { // Get rid of empty lines if (empty($line)) { continue; } $valid = true; foreach ($config['filters'] as $filter) { // Line has been marked as invalid if (!$valid) { break; } // Filter line based on the configuration if (preg_match($filter, $line) === 1) { $valid = false; break; } } // The line is valid, print it if ($valid) { $return .= $line."\n"; } } // Display the result of the command echo $return; } } // End of execute.php