How to use curl_getinfo() to get the total time in seconds take to load a website in PHP

1 Answer

0 votes
$curl = curl_init('http://www.seek4info.com/');

curl_exec($curl);

if (!curl_errno($curl)) 
{
  $info = curl_getinfo($curl);
  echo 'Time: ' . $info['total_time'] . ' seconds to load ' . $info['url'] . "<br />";
}

curl_close($curl);


/*
run: 

Time: 0.577 seconds to load http://www.seek4info.com/

*/

 



answered Jun 7, 2016 by avibootz

Related questions

3 answers 291 views
291 views asked Feb 13, 2021 by avibootz
2 answers 194 views
2 answers 1,042 views
1 answer 68 views
3 answers 154 views
...