How to write your own URL shortener in 25 lines of PHP code

These are step-by-step instructions with code examples. Cool!

Writing your own URL shortener in 25 lines of PHP :: Jaisen Mathai

So you want to write a URL shortener? Let’s make it short and painless. You’ll need two pieces: a key generator and redirector. The key generator is used to represent a shortened url with a series of characters, often a-zA-Z0-9. This is what you see at the end of tinyurl and bit.ly links. The redirector needs to link the key to a url and perform a HTTP redirect. Shall we?

Advertisements

~ by WPA Staff on January 22, 2010.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: