Since the TTFB can vary by every request, I want to make a statistic and get an average value for it. Does anyone know how I can measure this via PHP? The website bytecheck.com is able to analyze these data: Here is an example with example.com: http://www.bytecheck.com/results?resource=example.com
Does anyone a suggestions how I could achieve something like this?
Thanks in advance.
You can solve this with 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
There is a good Curl wrapper here: https://packagist.org/packages/curl/curl
If you already have installed Composer, just do 'composer require curl/curl' and use it.
Regards.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I'm quite new to programming apps for iOSI've had a deeper look into creating a login for an app
I am trying to build a service-based marketplace for online tutoringThis includes 'tutors' selling their service in units of hours to 'students'
In my code I have 5 mySQL seperate queries
I want to load some json data from an API with php into my pageHowever i dont know how to include the authorization