Trendalicious

Relates to Apache and PEAR, Blogging

Trendalicious provides a nice way to keep track of popular links in the del.icio.us database of social bookmarks. Unfortunately trendalicious does not come equiped with syndication, but it only takes a bite of the PEAR to put a simple request page together with HTTP_Request, Cache_Lite and an RSS builder.


// code snippet
$cache = new Cache_Lite($cache_options);

if (! $data = $cache->get(TRENDALICIOUS_URL)) {

    $r = new HTTP_Request(TRENDALICIOUS_URL);
    $r->sendRequest();
    $page = $r->getResponseBody();

    // create rss content from data in $page

    $cache->save($rss_content);

}

header('Content-type: text/xml');
echo $rss_content;

Since I intended on plugging this into Firefox live feeds, I gave the cache file a lifetime of 60 minutes to avoid bombarding the trendalicious page. Also I wanted to keep the feed private (need to keep personal bandwidth down as well), so I set up some basic security measures with mod_rewrite, a subdomain?


RewriteCond   %{HTTP_HOST}       !^subdomain
RewriteCond   %{REMOTE_ADDR}  !^xxx\.xxx\.xxx\.
RewriteRule .* -  [F,L]

? and a directive in robots.txt file.

Posted on Wednesday, Apr 06, 2005 at 01:53:39.

Comments on Trendalicious (0)

Breadcrumbs Trail

[ Home ] -> TW Blog -> Apr 05 -> Trendalicious
Site Map

The Severn Solutions website achieves the following standards:

[ XHTML 1.0 ] [ CSS 2 ] [ WAI AA ] [ Bobby AA ]

Page compiled in 0.008 seconds