RE: [PHP] Test Connection - fsockopen()

2003-10-21 Thread Jason Williard
Thank you.  That worked perfectly.

Jason

-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 21, 2003 12:34 AM
To: Jason Williard
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Test Connection - fsockopen()

Hi,

Tuesday, October 21, 2003, 5:04:14 PM, you wrote:
JW> I am trying to create a remote status page for my website.  So far,
I 
JW> have found the fsockopen() function and used the example code to
create 
JW> the following basic script:

JW>  $fp = fsockopen ("xxx.xxx.xxx.xxx", 80, $errno, $errstr, 30);
JW> if (!$fp) {
JW>  echo "Down\n";
JW> }
JW> else{
JW>  echo "Up\n";
JW>  fclose ($fp);
JW> }
?>>

JW> While this works when the server is UP, I get the following error
when 
JW> it is down along with the 'Down' output:

JW> Warning: fsockopen(): php_hostconnect: connect failed in 
JW> //public_html/status/test.php on line 2

JW> Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:80 in 
JW> //public_html/status/test.php on line 2
JW> Down

JW> Can anyone help me out here?

JW> Thanks,
JW> Jason Williard


change your call to   @fsockopen() which will tell it to ignore errors

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Test Connection - fsockopen()

2003-10-21 Thread - Edwin -
On Tue, 21 Oct 2003 00:04:14 -0700
Jason Williard <[EMAIL PROTECTED]> 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:
> 
>  $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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Test Connection - fsockopen()

2003-10-21 Thread Tom Rogers
Hi,

Tuesday, October 21, 2003, 5:04:14 PM, you wrote:
JW> I am trying to create a remote status page for my website.  So far, I 
JW> have found the fsockopen() function and used the example code to create 
JW> the following basic script:

JW>  $fp = fsockopen ("xxx.xxx.xxx.xxx", 80, $errno, $errstr, 30);
JW> if (!$fp) {
JW>  echo "Down\n";
JW> }
JW> else{
JW>  echo "Up\n";
JW>  fclose ($fp);
JW> }
?>>

JW> While this works when the server is UP, I get the following error when 
JW> it is down along with the 'Down' output:

JW> Warning: fsockopen(): php_hostconnect: connect failed in 
JW> //public_html/status/test.php on line 2

JW> Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:80 in 
JW> //public_html/status/test.php on line 2
JW> Down

JW> Can anyone help me out here?

JW> Thanks,
JW> Jason Williard


change your call to   @fsockopen() which will tell it to ignore errors

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Test Connection - fsockopen()

2003-10-21 Thread Jason Williard
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:


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?

Thanks,
Jason Williard
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php