Re: set timeout for fread() ?
| From: | J Smith | Date: | Fri, 12 Oct 2001 18:51:26 +0000 |
| Subject: | Re: set timeout for fread() ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70949@lists.php.net to get a copy of this message | ||
You could try looking at the sockets extension, specifically at
socket_select(). Be careful, though, as PHP's socket_select() has a bit of
a bug that's being fixed where you can't set the timeout to NULL as you can
in the standard system select() call. This will likely be fixed soon.
Also take note that the sockets extension is marked "experimental".
J
Arash Dejkam wrote:
> Hi,
>
> how can I set timeout for fread() ?
>
> I have some code like this :
> if ( $f = fopen( "http://$domain/$file" ,
> "r" ) )
> $i=fread($f,5000);
>
> for some specific $domains which the server can't read from because of
> network problems the script hangs because fread() doesn't have any timeout
> and the script waits to receive data forever !
>
> help me please.
>
> Arash