note 28701 added to function.fsockopen
| From: | david dot rensonnet at swing dot be | Date: | Tue, 21 Jan 2003 14:57:59 +0000 |
| Subject: | note 28701 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42518@lists.php.net to get a copy of this message | ||
Just commenting the above example about using fclose at the end..
>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";
*** Why not put here something like "fclose($fp);" :-) ***
>}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+28701
http://master.php.net/manage/user-notes.php?action=delete+28701
http://master.php.net/manage/user-notes.php?action=reject+28701