Dear expert
We are going to measure web server response time and develop PHP program using Mikrotik functions.
The code is shown in below. the output is response time in ms(millisecond).
Please advise;
<?php // check responsetime for a webbserver function pingDomain($domain){ $starttime = microtime(true); // supress error messages with @ $file = @fsockopen($domain, 80, $errno, $errstr, 10); $stoptime = microtime(true); $status = 0; if (!$file){ $status = -1; // Site is down } else{ fclose($file); $status = ($stoptime - $starttime) * 1000; $status = floor($status); } return $status; } echo pingDomain('[www.sanook.com](http://www.sanook.com)') ,ms, "
"; ?>