anyone can help mo to tell the algorithm how to make server uptime application like serveruptime.com?

http://www.duniaislam.site50.net

Hi Darco,

I assume you're after the PHP function you'd use for checking whether a server is up (the rest will just be a database of the sites you're monitoring).

Personally, I'd probably about it with a socket_connect call, that should be able to confirm a connection existing to an address, which I guess is all you are looking to confirm.

Actually, thinking it through, perhaps I'd go with something more like this... If you wanted to, you could read the contents of the URL, though I imagine you just want an UP or DOWN decision, I think the below would do the trick.

$cn = fsockopen ('http://www.daniweb.com', 443, $errnum, $errdesc, 30);

if (!$cn) {
// Can't Connect to URL
$sitestatus="DOWN";
}else{
// Connected fine - URL works
$sitestatus="UP";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.