使用 Curl 进行 PHP 加载时间测试

发布于 2024-09-12 16:42:52 字数 338 浏览 2 评论 0原文

使用 PHP 如果我使用 Curl 加载 URL http://www.cars.com 然后使用curl_getinfo()找到加载所需的总时间...它会计算加载时间,包括所有图像以及页面上显示的其他内容。或者只是位于 http://www.cars.com 的 HTML(或其他)文件?

curl_getinfo($ch, CURLINFO_TOTAL_TIME);

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);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

离旧人 2024-09-19 16:42:52

如果您使用 cURL 加载 HTML 页面,它只会加载页面本身,而不是任何链接的资源(例如图像)。

特别是,它不会让您清楚地了解使用 Web 浏览器加载页面需要多长时间。

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.

与风相奔跑 2024-09-19 16:42:52

如果您确实想要进行负载测试来补偿 CPU 使用率的上下波动,请使用 Apache 基准测试

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

兰花执着 2024-09-19 16:42:52

不,CURLINFO_TOTAL_TIME 将为您提供 cars.com 页面的传输时间。 Curl 不是浏览器,不会加载图像、javascript 等。Chrome

和 Firefox(通过 Firebug)都会很乐意为您报告此情况。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文