...

View Full Version : FTP Server status



rmelnyck
10-02-2003, 10:57 PM
Does ayone know how to write a script which detects the status of an FTP server and then indicates on a web page whether the server is up or down.

Any help would be appreciated.

Thanks!

Nightfire
10-02-2003, 11:47 PM
You could have an image file or something on the server, then maybe something like this would work



<?php
if(file_exists('ftp/url/to/image')){
echo 'Server online';
}else{
echo 'Server offline';
}
?>


Or maybe this


<?php
$fp = fsockopen ("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "Server offline";
} else {
echo "Server online";
}

?>

http://uk.php.net/function.fsockopen

rmelnyck
10-03-2003, 08:21 PM
Cool thanks!

SpeedFreak
10-03-2003, 08:35 PM
<?php
$fp = fsockopen ("www.example.com", 21, $errno, $errstr, 30);
if (!$fp) {
echo "Server offline";
} else {
echo "Server online";
}

?>

^^

That should be port 21, no point in checking for HTTP traffic on an FTP now is there :p

Nightfire
10-03-2003, 09:18 PM
lol well spotted :p



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum