Determine internet speed of visitors using PHP
Posted on 17. Jul, 2011 by khumlo Freddie in PHP, SEO
Determining your website visitor’s network bandwidth is one of the aspects which every website owner should keep in mind so to earn their visitors loyalty. Every visitor of yours will of course have different network speed at their disposal and designing your website light seems the definite answer. However, it is not always possible as you must have a selling feature(s) in your website to keep your visitors gel into your web portal and this means more memory (in terms of text, images, videos, flash etc) for the users to download.
So, how can we determine network speed of your target visitors and design website accordingly. Here I will send user a relatively larger amount of data and note the amount of time it takes for transmission to complete.
Test bandwidth speed using PHP
<?php // create new file size of say 1MB $file = fopen('testfile.txt','r'); $data = file_get_contents('testfile.txt'); //Determine size of the file $filesize = filesize('testfile.txt'); //Detemine start time $start = time(); //Send data to user print "<!-- $data -->"; //Determine end time $end = time(); //Calculate data transmission time $duration = $end - $start; //Determine visitor bandwidth $speed = round($filesize/$duration, 2); ?>
With this information, we can create two themes one for higher bandwidth and other for lower bandwidth or provide more caching for lower bandwidth. So, it’s up to you how do you use this information.
Related Posts
- No related posts found




