Created
July 16, 2014 14:25
-
-
Save levonlee/8e8e45e2411503b4e084 to your computer and use it in GitHub Desktop.
PHP Test Website Connection
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
$loop = 20; // Number of times to connect to website | |
$url = "http://www.yoursite.com/"; | |
$start = microtime(true); | |
for ($i=1; $i < $loop; $i++) { | |
$lstart = microtime(true); | |
$f = fopen($url, 'r', 0); | |
$meta_data =stream_get_meta_data($f)['wrapper_data'][0]; | |
fclose($f); | |
$ltime = microtime(true) - $lstart; | |
echo $i.": ".$meta_data.' time: '.$ltime.'<br/>'; | |
} | |
$ttime = microtime(true) - $start; | |
echo 'Total time: '. $ttime; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment