Jump to content

output ping of the server


newb

Recommended Posts

here is the fix...

$cmd = "/bin/ping -c 5 ".$_SERVER['REMOTE_ADDR'];
$ping = shell_exec($cmd); 

if(strlen($ping) < 5)
{ 
echo "? ms";
}
else
{
preg_match("/rtt min\/avg\/max\/mdev = (.*)\/(.*)\/(.*)\/(.*) ms/", $ping, $matches);
$urping = number_format($matches[1],0)." ms";
}

You said you wanted to get the ping response from the client to the server. That's a ping from the server to the client, which you specifically said you didn't want. It's probably the best you'll be able to get without the user installing anything, though.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.