Created
November 22, 2013 21:32
-
-
Save jackperry/7607244 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Your path to simplepie | |
include_once('/path/to/simplepie/simplepie.inc'); // Include SimplePie | |
// Feeds you want to aggregate | |
$feeds = array( | |
'http://jon.smajda.com/rss.xml', | |
'http://smajda.tumblr.com/rss', | |
'http://files.smajda.com/jon/feeds/greader/', | |
'http://twitter.com/statuses/user_timeline/14285636.rss', | |
'http://feeds.delicious.com/v2/rss/smajda', | |
'http://contexts.org/howto/feed/', | |
'http://github.com/smajda.atom' | |
); | |
date_default_timezone_set('America/Chicago'); | |
$feed = new SimplePie(); // Create a new instance of SimplePie | |
// Load the feeds | |
$feed->set_feed_url($feeds); | |
$feed->set_cache_duration (600); // Set the cache time | |
$feed->enable_xml_dump(isset($_GET['xmldump']) ? true : false); | |
$success = $feed->init(); // Initialize SimplePie | |
$feed->handle_content_type(); // Take care of the character encoding | |
?> | |
<?php if ($success) { | |
$itemlimit=0; | |
foreach($feed->get_items() as $item) { | |
if ($itemlimit==40) { break; } | |
?> | |
<?php echo $item->get_title(); ?> | |
<?php echo $item->get_permalink(); ?> | |
<?php echo $item->get_date('D, d M Y H:i:s T'); ?> | |
<?php if ($author = $item->get_author()) { echo $author->get_name()." at "; }; ?><?php if ($feed_title = $item->get_feed()->get_title()) {echo $feed_title;}?> | |
<?php echo htmlspecialchars(strip_tags($item->get_description())); ?> | |
<?php echo $item->get_content(); ?> | |
<? | |
$itemlimit = $itemlimit + 1; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment