I'm trying to write a script which will ping a LAN server and return a message saying "server is UP" or down depending on results. Any assistence would be greatly appreciated!!!!! <----very new to PHP and not quite comfortable yet
thanks!!!😕
Try this:
<?PHP $comm='ping -c 1 put_address_here'; $res=shell_exec($comm); echo $res; ?>
I tried this on my Windows Box but windows doesn't accept the -c 1 switch. But as most servers use Linux it should work.
thanks!!! works beautifully!!! now say i wanted to have a image returned if server is up and another returned if it is down?
$comm='ping -c 1 put_address_here'; $res=shell_exec($comm); if(strpos('Host Unreachable',$res)===FALSE) { //show your graphic here } else { // host was unreachable }