Files
controls-web/controls-rework/test/aitest.php
2026-02-17 09:29:34 -06:00

25 lines
445 B
PHP

ping network device using php and display results in a table
```
<?php
$ip = "192.168.0.11"
$ip = explode("\n", $ip);
echo "<table><tr><th>IP</th><th>Result</th></tr>";
foreach ($ip as $ip) {
$output = shell_exec("ping -n 1 $ip");
if (strpos($output, 'Received = 1')) {
echo "<tr><td>".$ip."</td><td>Online</td></tr>";
} else {
echo "<tr><td>".$ip."</td><td>Offline</td></tr>";
}
}
echo "</table>";
?>
```