PHP cannot do this trick on it's own and needs some Javascript making an AJAX call running on the client side to tell the server that the page has loaded.
PHP can record the starting time and then start outputting random data for say 10 seconds. The amount of traffic transferred in that 10 seconds can be used to detect link speed. It works because TCP has to send acknowledgements for each of its packets before it can continue (with a small error window called the TCP window).
Bookmarks