I needed a script in php that checked for a normal HTTP response from another server like http://www.example.com, a status script to see if the other server(s) where behaving as they should.
Anybody can help me?
You can do simply with help of cURL in php. You can send request and view exact time of request.
<?php
if(!isset($_GET['url']))
die("enter url");
$ch = curl_init($_GET['url']); //get url http://www.xxxx.com/cru.php?url=http://www.example.com
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
if(curl_exec($ch))
{
$info = curl_getinfo($ch);
echo 'Took ' . $info['total_time'] . ' seconds to transfer a request to ' . $info['url'];
}
curl_close($ch);
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With