function display_cached_file($identifier_url, $cache_location = './cache') { $cache = SimplePie_Cache::create($cache_location, $identifier_url, 'spi'); if ($file = $cache->load()) { if (isset($file['headers']['content-type'])) { header('Content-type:' . $file['headers']['content-type']); } else { header('Content-type: application/octet-stream'); } header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days echo $file['body']; exit; } die('Cached file for ' . $identifier_url . ' cannot be found.'); }