Simple PHP site for issuing wake-on-LAN commands on a button press
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ping.php 539B

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