fsockopen()
| From: | Phil Ewington - 43 Plc | Date: | Tue, 30 Sep 2003 10:46:01 +0000 |
| Subject: | fsockopen() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-164366@lists.php.net to get a copy of this message | ||
Hi All,
I am having problems with fsockopen() and wondered if anyone else has
encountered this behaviour. My problem is that when connecting to an invalid
domain I cannot trap the errors.
I have tried setting a variable then testing the value, which prints a
warning to the screen...
$sck_handle = fsockopen($hostname, $port, $errno, $errstr, $timeout);
if (!$sck_handle)
{
// socket could not be opened.
$http_statuscode = "Error:" . $errno . "-" . $errstr;
}
else
{
...
}
How can I get $errno & $errstr, are these for read/write errors rather than
socket initialisation? I need to know why the socket could not be opened so
I can give an appropriate error message.
TIA
Phil Ewington - Technical Director
----------------------------------
43 Plc
35 Broad Street, Wokingham
Berkshire RG40 1AU
T: +44 (0)118 978 9500
F: +44 (0)118 978 4994
E: mailto:phil.ewington@43plc.com
W: http://www.43plc.com