On Tue, January 29, 2008 9:58 am, John Papas wrote:
> I'm using file() to get the contents of a remote page in my script but
> I cannot find any information regarding how I could *gracefully*
> handle a broken network connection or even a time-out (slow
> connection).
>
> Is there a way?
>
> ---
> Example:
> $menu = file('http://www.remotesite.org/mypage.html');Use http://php.net/set_error_handler You can change the timeout with set_ini() right before the file() call. If $menu === false, then it failed. > foreach ($menu as $line_num => $line) { > echo $line."\n"; > } > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

