PHP5 has a native XML function that allows you to parse XML feeds as HTML, so if your web server run PHP5, you can use this script to filter by pubDate;
PHP Code:
$feed_file = 'http://www.mywebsite.com/path/to/my-rss-feed.xml'; // URL of RSS
$cache_file = 'temp/my-rss-feed.rss'; // path to cache file
$cache_time = 3600*24; // 24 hours (set to 0 for no cache)
$date_filter = '2013-03-21'; // Date filter YYYY-MM-DD
$timedif = @(time() - filemtime($cache_file));
if (file_exists($cache_file) && $timedif < $cache_time) {
$string = file_get_contents($cache_file);
} else {
$string = file_get_contents($feed_file);
if ($f = @fopen($cache_file, 'w')) {
fwrite ($f, $string, strlen($string));
fclose($f);
}
}
$xml = simplexml_load_string($string);
foreach ($xml->channel->item as $val) {
$date = date('Y-m-d', strtotime($val->pubDate));
if ($date == $date_filter) {
echo '<p><b>'.$val->title.'</b><br/>'.$val->pubDate.' : '.$val->description.'</p>';
}
}
(Adapted from http://www.finalwebsites.com/snippets.php?id=49 )
Bookmarks