Level 28
Here, what I found.
<?php
// Get the list of printers
if (PHP_OS_FAMILY === 'Windows') {
exec('wmic printer list brief', $output);
} else {
exec('lpstat -p', $output);
}
// Display the list in a table
echo "<table>";
echo "<tr><th>Printer Name</th><th>Location</th><th>Status</th></tr>";
foreach ($output as $line) {
$printer = explode(',', $line);
echo "<tr><td>{$printer[0]}</td><td>{$printer[1]}</td><td>{$printer[2]}</td></tr>";
}
echo "</table>";
?>
2 likes