Forum Moderators: coopster
[edited by: eelixduppy at 12:31 pm (utc) on Apr 13, 2012]
[edit reason] removed URL [/edit]
$url = "http://www.example.com/path/to/script";
$content = file_get_contents($url);
if(strpos($content, 'Online') !== 0) {
// it says online
} else {
// it doesn't
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_PORT, 24844);
if(curl_exec($ch) && curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) {
// server seems to be up
} else {
// server is down or there is an issue with the page
}
curl_close($ch);
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);