Using Curl for load time testing PHP

泪湿孤枕 提交于 2019-12-23 04:47:07

问题


Using PHP if I load the URL http://www.cars.com with Curl then use curl_getinfo() to find the total time it takes to load... Will it calculate the load time including all images, and anything else displayed on the page. Or just the HTML (or whatever) file that is located at http://www.cars.com ?

curl_getinfo($ch, CURLINFO_TOTAL_TIME);

回答1:


If you load a HTML page with cURL, it's just going to load the page itself, not any linked resources like images.

Particularly, it's not going to give you a good idea of how long it would take someone using a Web browser to load the page.




回答2:


use Apache benchmark if you really want a load test to compensate for ups/downs in cpu usage




回答3:


No, CURLINFO_TOTAL_TIME will give you the transfer time for the cars.com page. Curl is not a browser and will not load images, javascript etc.

Both Chrome and Firefox (via Firebug) will happily report this for you.



来源:https://stackoverflow.com/questions/3417484/using-curl-for-load-time-testing-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!