I'm trying to develop a PHP script which will calculate the internet connection speed of the users. In order to achieve this, the script will perform 5 basic tasks :
1) Fetch the time and store the value in a variable (say: $start_time)
2) Transfer a chunk of data (maybe a image or some other data file) to the user's PC which will be of approx. 250KB.
3) When the download finishes, fetch the time and store the value in a variable (say: $end_time)
4) Calculate the difference between the two times. ($end_time - $start_time) and store the output in another variable (say: $time_taken)
5) Do the appropriate maths to get the speed in KB/s. [I'm not elaborating this since its not necessary right now).
Now, I'm having trouble with step 2 only. In other words, I don't know how to make my script do this step. I want a chunk of data to be transferred to the user's PC. Can anyone tell me which PHP function will be used here?