chore: initial commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$host = "10.1.1.2";
|
||||
echo json_encode(ping($host));
|
||||
|
||||
function ping($host) {
|
||||
$command = "ping -c 4 " . escapeshellarg($host);
|
||||
$output = [];
|
||||
exec($command, $output, $status);
|
||||
|
||||
// Check if the ping was successful
|
||||
if ($status == 0) {
|
||||
return ['status' => 'online', 'output' => $output];
|
||||
} else {
|
||||
return ['status' => 'offline', 'output' => $output];
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user