Example using fping

(You could use piong instead, but if you install fping you can limit the time)


<?php
	$cfg_endpoint = "www.google.com";
	echo ("<p>Pinging $cfg_endpoint:</p>");
	echo ("<p>Result:</p>");
	//----- DO THE PING -----
	$output = shell_exec("fping -c1 -t750 $cfg_endpoint 2>&1");
	echo "<pre>$output</pre>";
?>