Skip to content

Instantly share code, notes, and snippets.

@hulbert
Created June 3, 2011 08:18
Show Gist options
  • Select an option

  • Save hulbert/1006046 to your computer and use it in GitHub Desktop.

Select an option

Save hulbert/1006046 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jun 3, 2011.
    29 changes: 29 additions & 0 deletions instapaper_likes.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    <?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; ?>