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:[EMAIL PROTECTED]
W: http://www.43plc.com

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

Reply via email to