Last active
January 27, 2016 19:54
-
-
Save Kaweechelchen/35c67650769c570d92c9 to your computer and use it in GitHub Desktop.
script to get the ping time to a domain host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$domain = 'http://mona.lu'; | |
echo getPingTime($domain); | |
function getPingTime($domain) { | |
$domain = parse_url($domain, PHP_URL_HOST); | |
exec("ping -c 1 " . $domain . " | head -n 2 | tail -n 1 | awk '{print $7}'", $ping_time); | |
return $ping_time[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment