Re: Test Connection - fsockopen()
| From: | - Edwin - | Date: | Tue, 21 Oct 2003 07:40:37 +0000 |
| Subject: | Re: Test Connection - fsockopen() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166914@lists.php.net to get a copy of this message | ||
On Tue, 21 Oct 2003 00:04:14 -0700
Jason Williard <jason@janix.net> wrote:
> I am trying to create a remote status page for my website. So far,
> I have found the fsockopen() function and used the example code to
> create the following basic script:
>
> <?php
> $fp = fsockopen ("xxx.xxx.xxx.xxx", 80, $errno, $errstr, 30);
> if (!$fp) {
> echo "Down\n";
> }
> else {
> echo "Up\n";
> fclose ($fp);
> }
> ?>
>
> While this works when the server is UP, I get the following error
> when it is down along with the 'Down' output:
>
> Warning: fsockopen(): php_hostconnect: connect failed in
> /****/public_html/status/test.php on line 2
>
> Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:80 in
> /****/public_html/status/test.php on line 2
> Down
>
> Can anyone help me out here?
Not sure what kind of help you're looking for but if you just want to
suppress errors, try this instead:
$fp = @fsockopen("xxx.xxx.xxx.xxx", 80, $errno, $errstr, 30);
Or, adjust error_reporting level: http://www.php.net/error-reporting
- E -
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/