note 28487 added to function.fsockopen
| From: | kj at mendosus dot org | Date: | Tue, 14 Jan 2003 18:04:26 +0000 |
| Subject: | note 28487 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42137@lists.php.net to get a copy of this message | ||
I use fsockopen at my webpage to verify some services, like ftp and streaming server and such. If
fsockopen can connect to the given IP+port it is a verification that the service runs. Example:
if($fp = fsockopen ("xxx.xxx.xxx.xxx", 21, $errno, $errstr, 10)){
echo "FTP server in online";
}else{
echo "FTP server is offline";
}
$fp = null; //Don't use fclose() here. If the connection was refused it will throw an error
Just as an idea of how to use it.
regards
Kristian
--
http://www.php.net/manual/en/function.fsockopen.php
http://master.php.net/manage/user-notes.php?action=edit+28487
http://master.php.net/manage/user-notes.php?action=delete+28487
http://master.php.net/manage/user-notes.php?action=reject+28487