/ Published in: PHP

use this to cache a remote file with xml, json etc
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$url = 'http://...'; #we need to do some caching here $cache_time = 24 * 60 * 60; // time to cache file, # minutes * seconds // check the cache_dir variable if(is_dir($cache_dir) && is_writable($cache_dir) && file_exists($cache_file) && time() - $cache_time < filemtime($cache_file)){ } else { }
Comments
