Possible Duplicate:
Pinging an IP address using PHP and echoing the result
How do you ping an ip addresses in php. and give the the results as if you are on cmd program in windows
<?php
system(‘ping -c 192.168.0.104’); // Ping IP address.<br>
echo “pinged”;<br>
?>
I just pinged google with that exec
output was:
output looks like below
Try this
Note: This is dependant on the OS you are running. Windows will default to only 4 pings while Linux will ping forever.
To ping twice in Windows, use "ping -n 2 host"
To ping twice in Linux, use "ping -c 2 host"