pdn.to URL shortener
Not another URL shortener…
Well yes, I’m afraid so. I whipped up this site in order to play around with a few frameworks and technologies that I’m relatively new to. These include:
- PHP on Windows – This site is hosted on a VPS which runs Windows Server 2008 (not by choice, but I’m not going to argue). Having some experience using PHP in a classic LAMP setup, I was curious to see what it would be like in a Windows / IIS / MS-SQL Express (WIMP) environment. As it turned out, there was a bit of fuss getting IIS to play nicely, but on the whole it was easy enough to set up and works well.
- CodeIgniter framework – I wanted to find a fairly lightweight PHP framework for another project, and after a bit playing around with this one, it hits the mark nicely. It’s probably overkill for a basic site like this, but it’s a pleasure to code with.
- Silverlight – Having never used Silverlight before I wanted to get a bit of a feel for how it’s used and deployed.
- Design – I wanted to try my hand at a bit of graphical and layout design with something simple.
The site does the following things:
- Shortens URLs
(ones that are longer than 19 characters, anyway), performs automatic redirects and hit logging, as you’d expect.
- Provides a simple Silverlight control, when available, to automatically copy the generated URL to the users clipboard, similar to what bit.ly does with a flash control.
- Generates QR codes on a <canvas>. I was planning to write my own QR code generator but instead found Kazuhiko Arase’s excellent script.
- Checks the ‘reputation’ of target domains for anything nasty using the Web of Trust API.
- If an URL is deemed to be potentially unsafe, issues a warning to users instead of automatically redirecting them (e.g. http://pdn.to/56gda).
Various bits of code used on the site can be found on my GitHub. More specifically, the Silverlight control source can be found at http://gist.github.com/513381 and most of the PHP is at http://gist.github.com/517938.
I’m vaguely planning on adding functionality to take screenshots of submitted pages (with obvious restrictions) in order to display a thumbnail preview to the user.
Moved to the pdn.to domain (from the less succinct u.peterdn.com).