fsockopen() throwing errors
| From: | Phil Ewington - 43 Plc | Date: | Fri, 28 May 2004 15:25:48 +0000 |
| Subject: | fsockopen() throwing errors | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-187128@lists.php.net to get a copy of this message | ||
Hi All,
How can I stop fsockopen() throwing an error and killing my script when it
cannot connect?
I have tried the following:
$this->_Socket = fsockopen($s_server, $this->_Port, $i_errno, $s_errstr,
$this->_Timeout);
if (!$this->_Socket)
{
... code to handle connection failure
}
and ...
if (!$this->_Socket = fsockopen($s_server, $this->_Port, $i_errno,
$s_errstr, $this->_Timeout))
{
... code to handle connection failure
}
I have also tried prefixing fsockopen() with @ but when it fails to connect
it kills my script by throwing an error. Any advise here will be much
appreciated as this code is mission critical.
TIA
- Phil.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004