I have written scripts to download XML data via HTTP. I would like to record (in a database) how long it takes to download the XML file. Does PHP have a built in function for timing the length of a download?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PHP has built in functions to record time. Many people use microtime() to profile their functions.
Here’s an example from the manual:
IMPORTANT NOTE: As @toon81 mentioned in a comment on the other post, you have to watch out for time changes on the server. As mentioned in the comments section of the microtime manual page
“However it is true that result depends of gettimeofday() call. […] If system time change, result of this function can be unpredictable (much greater or less than zero).”