How To Check From Php/html If Website Is Up?
I want the users of my website to check if any other website (http and/or https) is up. There are sites out there that use google analytics for that (if I understood it right). But
Solution 1:
You can use server side Curl and monitor http response header, site timeouts.
Solution 2:
One can try to connect directly to the http(s) port of the server.
$canConnect = FALSE;
$host = 'www.example.com';
$service_port = 80; // http, for https use 443;$address = gethostbyname ($host);
$socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket !== FALSE) {
$result = socket_connect ($socket, $address, $service_port);
if ($result) {
$canConnect = TRUE;
}
socket_close($socket);
}
Solution 3:
You could ping the servers and monitor the responses. This link shows you the implementation in PHP: http://www.darian-brown.com/php-ping-script-to-check-remote-server-or-website/
Post a Comment for "How To Check From Php/html If Website Is Up?"