3) { $i--; break; } $ch = curl_init(date2img($day)); curl_setopt($ch, CURLOPT_FAILONERROR, TRUE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_FILE, $fp); curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if($code == 200) break; $day = shift_days($day, -1); } fclose($fp); print("\n"); return $day; } header("Content-Type: application/xml"); header('Content-Disposition: inline; filename="rss2.xml"'); print("\n"); $cache_file = ".rss-cache"; $count = intval($_REQUEST['n']); if($count == 0) $count = 10; $lastcheck = 0; $cacheday = 0; if(file_exists($cache_file)) { $handle = fopen($cache_file, "r"); list($lastcheck, $cacheday) = fscanf($handle, "%u\t%u\n"); fclose($handle); } $lastday = $cacheday; if($cacheday == 0 || $lastcheck == 0 || (time() - $lastcheck) > 60*30) { $lastday = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")); $lastday = find_next_available_date($lastday, $cacheday); $handle = fopen($cache_file, "w"); fwrite($handle, sprintf("%u\t%u\n", time(), $lastday)); fclose($handle); } else print("\n"); ?> Garfield daily comic http://www.garfield.com/comics/comics_todays.html The daily comic of Garfield, from ucomics.com http://blogs.law.harvard.edu/tech/rss ]]>"; print << $title $url $url $date $desc EOLAST; $lastday = shift_days($lastday, -1); } ?>