Hi Aaron,
Neither file() or fopen() support setting timeouts on their reads. Unfortunately you'll have to use fsockopen() and get involved with the nuts & bolts of HTTP. Something like this:
<?
$fp = fsockopen("www.comicsite.com", 80, $errno, $errstr, 15); // Note the 15 here is the timeout in seconds
if( !$fp ) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
while (!feof($fp)) {
$page_content .= fgets ($fp,128);
}
fclose ($fp);
}
// Do your parsing on $page_content here
?>
Hope that helps. I can't do too much detail because I don't know exactly what you are doing. One thing to note is that set_time_limit() is a timeout for the whole script, not for any particular function calls. Therefore, you'll have to make sure it is at least as high as the sum of all the fsockopen() timeouts on your page, plus a bit for overhead.
All the best,
Louis