-2

I have an application to develop for the university. Something simple. But I'm inexperienced on how to do it. It's exactly what I want to do; If I send ping 50 IP addresses at 3 minute intervals, I would like the IP address to write on the admin panel off if it is turned off and open if it is turned on. (red and green button maybe ) How ı can do it exactly? Since the servers belong to us, I want the commands to work correctly. What exactly do I want to show on the screen if Ping is successful?

1 Answers1

0

You can quickly use the hostsystems ping-command by using shell-execution, if available. So you don't have to implement your own php-ping-service as described in the other solution. This can be done if easier solutions don't work. In my opinion less code is always better.

<?php
$output = shell_exec('ping www.stackoverflow.com');
echo "<pre>$output</pre>";
?>
nologin
  • 1,402
  • 8
  • 15