I'm developing a tool to analyze the website given by the user. One of the important parts is to show the loading time of the website. How can I implement this in PHP? I tried the following method
Method 1:
Download HTML code of the website parses it, find each resource like CSS files, JavaScript files, images etc. Then download one by one.
Problem: Since real browsers like Chrome, they download around 6 resources at a time. PHP can't do asynchronously. Difficult to implement cache.
Method 2:
Using Apache's Bench mark tool. Seems pretty well. I can set concurrent connections and everything. Excellent tool. Can even enable Gzip.
ab -n 100 -c 10 http://www.google.com/
Problem: How I can enable cache? Because I want to test the website two times (to show the loading time with cache). I also heard Apache AB test doesn't download resources. Anyone know?
Is there any other method? Or is there any way to fix the problem of method ?