RE: [PHP] Re: fsockopen() errors.
| From: | Phil Ewington - 43 Plc | Date: | Tue, 09 Mar 2004 11:17:06 +0000 |
| Subject: | RE: [PHP] Re: fsockopen() errors. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-179882@lists.php.net to get a copy of this message | ||
Tom,
Thought about that one or simply trying to catch the error in my site wide
error handler, will give it a try, thanks.
-- Phil.
> -----Original Message-----
> From: trlists@clayst.com [mailto:trlists@clayst.com]
> Sent: 08 March 2004 15:53
> To: PHP
> Subject: [PHP] Re: fsockopen() errors.
>
>
> On 8 Mar 2004 Phil Ewington - 43 Plc wrote:
>
> > Can anyone tell me the best way to avoid errors using
> fsockopen(). I have
> > tried wrapping the function call in a conditional statement,
> and have also
> > tried calling the function and then testing the return.
>
> Here's an approach I have used to avoid any error messages at all --
> presumably you could also set a flag in the error handler to indicate
> what happened, if you need that.
>
> .....
>
> $olderr = error_reporting(0);
> set_error_handler("ignoreerrhandler");
> $fp = fsockopen(.....)
> restore_error_handler();
> error_reporting($olderr);
> if ($fp) {
> [worked]
> } else {
> [failed]
> }
> .....
>
> function ignoreerrhandler($errno, $errstr, $errfile, $errline) {
> return;
> }
>
> --
> Tom
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>