PapaScott I like big blogs and I cannot lie! 🐘

The New Old Blogroll

I'm now including the update times in my blogroll like I used to. Blogrolling makes my data available as a chronologically sorted RSS file, which I can parse quite easily using the Magpie RSS Parser for PHP (thanks to Martin for the tip). Magpie chokes if any entities are in the file, but since I set the titles myself, I can easily avoid that. I do need to do a bit a parsing to convert the 'Last updated' string to a time/date I can use. One advantage over the data from blo.gs is that I can include sites that do not ping weblogs.com when they update. They land at the bottom of the list. Eventually I'll figure how to check them for updates as well (RSS feed? HTTP headers? md5 sums?).

<h4>blogroll (CET):</h4>
<?php
require_once('./blogroll/rss_fetch.inc'); #magpie rss parser
# in rss_fetch.inc I've set $CACHE_AGE to 60*10 instead of 60*60
$url = 'http://rpc.blogrolling.com/rss.php?r=ff5c543c6d32b2efee7f40bbb537da2d';
list( $rss, $status, $msg) = fetch_rss( $url );
$yesterday=strtotime('0:00 yesterday');
foreach ($rss->items as $item ) {
    $t = str_replace(array('Last updated: ','on '),'',$item[description]);
    $t = strtotime($t);
    $fmt = $t > $yesterday ? "H:i" : "d M";
    $date = $t>0 ? date($fmt,$t) : '-';
    if ($t>0) $title = "Last updated: ".date('H:i:s',$t).
        " CET on ".date('l, F d',$t);
    else $title = "Last updated: unknown";
    echo "<a href="$item[link]" title="$title">";
    echo "$date $item[title]";
    echo "</a><br />n";
}
?>
comments powered by Disqus