note 28701 deleted from function.fsockopen by nlopess
| From: | nlopess@php.net | Date: | Sat, 27 Dec 2003 15:13:55 +0000 |
| Subject: | note 28701 deleted from function.fsockopen by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62564@lists.php.net to get a copy of this message | ||
Note Submitter: david.rensonnet@swing.be
----
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