bandwidth speed test

From: Date: Wed, 30 Aug 2000 22:14:09 +0000
Subject: bandwidth speed test
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14694@lists.php.net to get a copy of this message
Hello, Is there a script out there that does the bandwidth speed test like the one on http://www.computingcentral.com/topics/bandwidth/speedtest.asp I'd like my DSL customers be able to check their speed to our server. Here's my code so far. It runs in Netscape browser, but in Microsoft Explorer, it just keeps on looping with the refresh meta tag unless I use Ctrl-F5 instead of clicking on the "Re-run test" link. Also, for some reason, the speed test I have comes out to be half as fast on Netscape than Explorer.. If Explorer gets 6Mb/s, Netscape would get 3Mb/s.. As you can see, I use phplib for session control, so if you want to test the code, install phplib first. Robin <? page_open(array("sess" => "test_Session")); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); srand((double)microtime()*1000000); function getmicrotime() { $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; return ($mtime); } if (!$start_time) $refresh = 1; ?> <html> <head> <? if (isset($refresh)) { $url = $sess->url("$PHP_SELF?rnd=".rand()); print "<meta http-equiv=\"refresh\" content=\"0; url=$url\">"; } ?> </head> <body> <? if (!isset($refresh)) { $KB = ((500969/1024)/(getmicrotime()-$start_time)); printf ("%s KByte/s<br>\n",number_format($KB,2)); printf ("%s KBit/s<p>\n",number_format($KB*8,2)); $sess->unregister("start_time"); ?> <a href="<? $sess->purl("$PHP_SELF?rnd=".rand()) ?>">Re-run test</a><br> <? } else { $start_time = getmicrotime(); $sess->register("start_time"); print "testing line speed...<br>\n"; ?> <!-- 643354467515594314525669479634345769481675542273821989441397778477256638714934137 25412874217462471899367934422286964766497129637175619561763253556822556731915423 There are more lines of this, but you get the idea. 42958844284574536894716835159975115472772725168865536724891649332292466933554983 1442147788114316136779281991134416186578378548542255565485323423966816784614666 --> <? } ?> </body> </html> <? page_close() ?>

« previous php.general (#14694) next »