I am working on a URL shortening site which uses PHP, MySQL and Apache. General idea of URL shortening as I look at open source projects: user gives a URL link and the syste
You can use bit.ly (twitter uses this). There are some APIs which you can use to call and fetch shortened URLs.
Also talk about shortening URLs, you can simply use a table like this
CREATE TABLE `urls` (
`id` varchar(255) NOT NULL default '',
`url` text NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Where you can have the id
(in base 36 to prevent exhaustion of 32 bit integers) to be the shortened id - http://host/?id
and when you call the URL http://host/?As2dD24B, it will look up the matching ID and URL, then redirects to the URL. simple?
Also keep in mind that you can expand your base 36. I am assuming that your base 36 is: a-z and 0-9. You can add in A-Z (another 26) and other symbols (such as ?,:*&^%$#@).