Jump to content

cURL and page loading time question


deviantPsyche

Recommended Posts

I'm trying to figure out a way to get page loading time while the page is still loading. What I want to do is to stop script execution if the amount of loading time is for example > 10 seconds during page load.

 

I'm using curl to load my pages. So far, the only way I can see this happening is to use CURLOPT_WRITEFUNCTION to call another function within curl. But the problem with it, is that it still not able to pull out live time elapsed from it. If I use curl_getinfo within that function I'm only able to print out curl_getinfo['total_time'] after the whole page loads. Is there a way to get the page loading time before the whole page loads?

Link to comment
https://forums.phpfreaks.com/topic/187636-curl-and-page-loading-time-question/
Share on other sites

yeah I actually found a much easier way to end the script execution time by simply setting CURLOPT_CONNECTTIMEOUT to timeout that I want, the problem is that I actually need to call a function on timeout so that I can do something else with the script. Is it possible to somehow catch when CURLOPT_CONNECTTIMEOUT is true so that I can return something else and then call another function?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.