Ping server in PHP
Description
The following code shows how to ping server.
Example
<?php//from w ww. j a v a 2 s . co m
// Which server to ping?
$server = "www.example.com";
// Ping the server how many times?
$count = 3;
// Perform the task
echo "<pre>";
system("/bin/ping -c $count $server");
echo "</pre>";
// Kill the task
system("killall -q ping");
?>
The code above generates the following result.