Re: Test Connection - fsockopen()

From: Date: Tue, 21 Oct 2003 07:34:20 +0000
Subject: Re: Test Connection - fsockopen()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-166913@lists.php.net to get a copy of this message
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> <?php 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

« previous php.general (#166913) next »