Handle time-outs and errors with file()
| From: | John Papas | Date: | Tue, 29 Jan 2008 15:58:09 +0000 |
| Subject: | Handle time-outs and errors with file() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-268245@lists.php.net to get a copy of this message | ||
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');
foreach ($menu as $line_num => $line) {
echo $line."\n";
}