Return to Snippet

Revision: 3703
at September 4, 2007 01:59 by bitcrumb


Initial Code
<?php
$username   = 'your_username';
$password   = 'your_password';
$cache_file = '/tmp/blogroll.xml';
 
// check for updates to del.icio.us account
$update = simplexml_load_file("https://{$username}:{$password}@api.del.icio.us/v1/posts/update");
 
if (strtotime($update['time']) > filemtime($cache_file))
{
    // del.icio.us has been updated since last cache; recache
    $data = file_get_contents("https://{$username}:{$password}@api.del.icio.us/v1/posts/all?tag=blogroll");
    file_put_contents($cache_file, $data);
}
 
// read links from cached del.icio.us data
$blogroll = simplexml_load_file($cache_file);
 
foreach ($blogroll->post as $blog)
{
    echo '<a href="' . htmlentities($blog['href']) . '">';
    echo htmlentities($blog['description']);
    echo "</a><br />\n";
}
?>

Initial URL
http://benramsey.com/archives/generating-opml-from-delicious/

Initial Description

                                

Initial Title
Generate blogroll from del.icio.us links

Initial Tags
xml, links, api

Initial Language
PHP