dotjay.com / lab / experiments / delicious-proxy

del.icio.us proxy

Last updated: April 2, 2008

A way to save bookmarks to your del.icio.us account without going to the del.icio.us website itself.

What you will need

Important! The newest version of the PhpDelicious library has dropped support for PHP 4, so if you have trouble using del.icio.us proxy with PhpDelicious, try downloading del.icio.us proxy with the older version of PhpDelicious below. However, it is highly recommended that everyone upgrades to using PHP 5 very soon; I will be updating the del.icio.us proxy code accordingly… when I find a few minutes to do it!

Download: del.icio.us proxy v1.1 – April 2, 2008

Change log

Installation

  1. Extract the files:
    • Extract the proxy code to a directory – I will use “delicious/” for my examples.
    • If you have downloaded the PhpDelicious library separately, extract its files to a subdirectory called “php-delicious” – mine is in “delicious/php-delicious/”.
  2. Open up the proxy settings (“delicious/settings.php”) and prepare your proxy:
    • Change the “location” to be the URL on your site that’s going to act as your proxy. For example, something like “http://example.com/delicious/”. The URL must include a trailing forward slash.
      // full location of this script on your server
      define('LOCATION', 'http://example.com/delicious/');
    • To stop other people using your proxy to save bookmarks to your del.icio.us account, you need to set a “key”. This will be used to identify yourself when using the proxy.
      // set yourself a token (a "key") to identify yourself to the script when you wish to post
      define('KEY', 'yourkey');
    • The proxy will remember your del.icio.us username and password for you. Set up the username and password for your del.icio.us account.
      // your del.icio.us username and password
      define('DELICIOUS_USERNAME', 'username');
      define('DELICIOUS_PASSWORD', 'password');
    • Optionally, change any of the default optional settings as described in the settings.php file. These control the display of tags when posting, caching and additional anti-throttling protection.
  3. Upload the directory to the desired location on your host (e.g. “http://example.com/delicious/”).

Additional installation notes

Using the proxy

  1. Open up the location of your proxy in your browser. You will need to add “?key=yourkey” to the URL to be able to access the proxy the first time, something like “http://example.com/delicious/?key=yourkey”
  2. You’ll want a bookmarklet to make using your new proxy as easy as possible. Once you’re on your proxy page, you should see the del.icio.us proxy form. Pop down to the bottom of the page and hit the “del.icio.us proxy bookmarklet” link. This will generate a bookmarklet for you. Drag the bookmarklet to your browser’s bookmarks and try it out.

If you get any problems, give me a shout.

Change log

Soon: upgrading to PHP 5.

  1. del.icio.us proxy v1.1 – April 2, 2008 (download)

    • FIXED: Cleaned data now properly populates the form.
    • FIXED: Tidied up after stupid markup issues; pages now validate.
    • ADDED: Improved CSS styling.
    • ADDED: Useful link to your del.icio.us profile.

    Affects: form.thtml, index.php, s.css

  2. del.icio.us proxy v1.0.1 – December 6, 2007

    • FIXED: Bookmark description and extended notes no longer include escaped characters.

    Affects: index.php

  3. del.icio.us proxy v1.0 – October 31, 2007

    • Initial release (call it a “beta”)

Notes

At time of writing, the PhpDelicious library needed a tweak before it would work properly. If you download my tweaked version of the library, you should be fine. However, if you decide to download the latest copy of the PhpDelicious code for use with the proxy, you may need to do these tweaks yourself.

It seems that the response data returned by the del.icio.us API has changed since the last version of the PhpDelicious code was released, or at least the response differs depending on situation. To get it to work reliably, I needed to change line 366 of the “php-delicious.inc.php” file:

// old code
//return $this->GetBoolReturn($aResult['content']);

// new code
if (isset($aResult['attributes']['CODE'])) {
	return $this->GetBoolReturn($aResult['attributes']['CODE']);
} else if (isset($aResult['content'])) {
	return $this->GetBoolReturn($aResult['content']);
} else {
	// presume it failed?
	return false;
}

Back to the Experiments index.

Back to the Lab index.