/**********************************************************************************
* feed_dates.php
* Version: 1.00
* Author: Rogers Cadenhead
* Date: 06/19/2004
* http://www.cadenhead.org/workbench/
*
**********************************************************************************
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This work is hereby released into the Public Domain. To view a copy of the public
domain dedication, visit http://creativecommons.org/licenses/publicdomain/ or
send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
94305, USA.
**********************************************************************************/
// This code requires the Magpie RSS library for PHP
// http://magpierss.sourceforge.net
require('feedrouter/magpie/rss_fetch.inc');
require('feedrouter/magpie/rss_utils.inc');
// convert syndicated feed date values to Unix timestamps
// $item is an array holding a syndicated feed
function displayUnixTimestamp($item) {
$rss_2_date = $item['pubdate'];
$rss_1_date = $item['dc']['date'];
$atom_date = $item['issued'];
if ($atom_date != "") $date = parse_w3cdtf($atom_date);
if ($rss_1_date != "") $date = parse_w3cdtf($rss_1_date);
if ($rss_2_date != "") $date = strtotime($rss_2_date);
if ($date == "") $date = time();
return $date;
}
// read a feed and display item timestamps
function readFeed($feed_url) {
$rss = fetch_rss($feed_url);
$text = "";
foreach ($rss->items as $item ) {
$text .= date("r", displayUnixTimestamp($item)) . " ";
}
return $text;
}
$atom_data = readFeed("http://www.orlandovacationer.com/atom.xml");
$rss1_data = readFeed("http://www.orlandovacationer.com/index.rdf");
$rss2_data = readFeed("http://www.orlandovacationer.com/index.xml");
ECHO <<