This repository has been archived on 2020-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
server-wakeonlan/ping.php

21 lines
539 B
PHP
Raw Normal View History

<?php
// -------------------------------------------
// Wake On LAN Webclient -- on private LAN
// copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
// -------------------------------------------
if (isset($_GET['hostname'])) {
$foo = array(); $status;
exec("ping -c 1 ".$_GET['hostname'], $foo, $status);
if (!$status) {
echo "1 online";
} else {
echo "0 offline";
}
} else {
header("HTTP/1.1 400 Bad Request");
echo "ERROR: invalid request";
}