Shorten links with is marvellous. Here's a short function that I've written to automatically shorten links, which I needed for Media UK. You'll need to register with and get your api key - it's free and only takes a moment.

Alternatively, I've now written my code to make your own shortlinks server.

// Use it like so

if ($shortlink=get_short_link("")) 
    echo $shortlink;
} else {
    die("There's been a grave error");

// And here's the function

function get_short_link($url) {
// v0.2 24 May 08: added a URLdecode function, to correctly cope with some charactersets
//                 thanks to Nick at


$api_call = file_get_contents("".$url."&login=".$bitly_login."&apiKey=".$bitly_apikey);


if ($bitlyinfo['errorCode']==0) {
return $bitlyinfo['results'][urldecode($url)]['shortUrl'];
} else {
return false;


Download this code