performance - PHP: measure TTFB (Time To First Byte) -
since ttfb can vary every request, want make statistic , average value it. know how can measure via php? website bytecheck.com able analyze these data: here example example.com: http://www.bytecheck.com/results?resource=example.com
does suggestions how achieve this?
thanks in advance.
you can solve curl:
$url = 'https://www.example.com/'; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 0); curl_setopt($ch, curlopt_nobody, 1); curl_setopt($ch, curlopt_followlocation, 0); curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); echo "ttfb of ".$url." is: ".$info['starttransfer_time']; result
ttfb of https://www.example.com/ is: 0.67417
Comments
Post a Comment