Skip to content

Instantly share code, notes, and snippets.

@hulbert
Created June 3, 2011 08:18
Show Gist options
  • Save hulbert/1006046 to your computer and use it in GitHub Desktop.
Save hulbert/1006046 to your computer and use it in GitHub Desktop.
Super Simple Instapaper Likes List with Simplepie
<?php
@include 'php/simplepie/simplepie.inc';
$instapaper_url = "YOUR INSTAPAPER RSS FEED HERE";
$feed = new SimplePie();
$feed->set_feed_url($instapaper_url);
// $feed->enable_cache(false); // for use before setting up caching
$feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/php/simplepie/cache');
$feed->set_cache_duration(60*15);
$feed->handle_content_type(); /* important, sets to UTF-8 */
$feed->init();
if ($feed->get_item_quantity() > 0):
echo '<ul>';
foreach ($feed->get_items(0,5) as $like): ?>
<li>
<a href="<?=$like->get_permalink()?>" target="_blank">
<? if (strlen($like->get_title()) > 55) {
echo substr($like->get_title(),0,55), '&hellip;';
} else echo $like->get_title(); ?>
</a>
</li>
<? endforeach;
endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment