MovableBlog: Integrating del.icio.us with PHP and Magpie

Nuance 2.0

April 16, 2004

In December of last year I published a way to integrate into your Movable Type-powered weblog. If you have PHP installed on your system, you can use the Magpie RSS PHP library in conjunction with the following PHP code to integrate del.icio.us on any website that has PHP. You will need to replace every instance of username with the del.icio.us links you wish to syndicate.

<h4><a href="http://del.icio.us/username">del.ico.us</a> links</h4>
<ul>
<?php

require_once "rss_fetch.inc";
// change to reflect path of rss_fetch.inc

$yummy = fetch_rss("http://del.icio.us/rss/username");

$maxitems = 15;

$yummyitems = array_slice($yummy->items, 0, $maxitems);

foreach ($yummyitems as $yummyitem) {

print '<li>';
print '<a href="';
print $yummyitem['link'];
print '">';
print $yummyitem['title'];
print '</a>';
if (isset($yummyitem['description'])) {

print ': ';
print $yummyitem['description'];

}
print '</li>';
print "\n";

}

?>
</ul>

Posted by Richard at 2:04