Using del.icio.us with PHP

You can get a straight HTML feed and directly include it into a PHP-generated page.

I’ve got stuff in weblog-links,weblog-reading, and weblog-blogroll tags on my del.icio.us page.

I’ve got a shell script (again using GNU wget) that passes the correct parameters to pull those down into straight HTML files:

#!/bin/bash
wget "http://del.icio.us/html/mrbill/weblog-reading/?tags=no&rssbutton=no&divclass=&aclass=&tagclass=&bullet=" \
-O ./weblog-reading.html
wget "http://del.icio.us/html/mrbill/weblog-blogroll/?tags=no&rssbutton=no&divclass=&aclass=&tagclass=&bullet=" \
-O ./weblog-blogroll.html
wget "http://del.icio.us/html/mrbill/weblog-links/?tags=no&rssbutton=no&divclass=&aclass=&tagclass=&bullet=" -O \
./weblog-links.html

I then use those HTML files in my main index page with PHP like so:

<? include("data/weblog-blogroll.html"); ?>
<? include("data/weblog-reading.html"); ?>
<? include("data/weblog-links.html"); ?>

etc. That’s all there is to it!

I’ve moved the old RSS feed instructions to a separate page.

4 thoughts on “Using del.icio.us with PHP

  1. Hello Bill,

    Thank you very much for these directions, which I’m happily using to keep my “Del.icio.us Deflexions” up to date. I have a question: I’m new to PHP so this is probably easy. I’d like to set up a *secret* script that I can periodically run from a web browser which will run my wget script. I know that I could run it from a cron job, but it makes more sense for me to run it by hand after I’ve updated my del.icio.us deflexions (which happens only a few times a day at most). I’m currently doing this by hand from an ssh window, but I’m not always ssh’d to my web host (but I do always have a web browser running).

    Thanks for any tips!
    Nancy

  2. Making the above shell script (yes it’s a shell script, so the /bin/bash bit could/should be /bin/sh) into a cgi script is as easy as adding

    echo Content-type: text/plain; echo

    to the top of it.

    You may want to put it in a separate, password protected, directory. (Should be easy if you’re using Apache.)

Comments are closed.