time() - $expires)) { // Cache expired, or does not exist $feed = file_get_contents("http://www.sinfest.net/rss.php"); $feed = preg_replace('!(\s*)(.+?\.(?:gif|png|jpe?g))!', '$0$1<img src="$2" alt="Comic">', $feed); $feed = preg_replace('/^\s*/', '', $feed); // Source feed has illegal initial whitespace $c = fopen($cache, "w"); fwrite($c, $feed); fclose($c); } else { // Was cached, so retrieve $feed = file_get_contents($cache); } header('Content-type: application/rss+xml'); echo $feed; ?>