View Full Version : Unshorten a URL via PHP?
02-11-2010, 11:40 PM
Does anyone know a good way to unshorten a URL using PHP ? What I mean are tinyurls, bit.ly, etc..
02-12-2010, 12:23 AM
hmmm, maybe can use mysql to store shorturl + long url,
if you are not running a service, why not use .htaccess
02-12-2010, 01:55 AM
You have three choices:
The first is to do it incrementally (ie aaa aab aac and so on adding to the database every time)
The second randomly with a random string generator, and check to see if that has already been taken in your database, and if not add it. Something like my php random string function (http://www.jaygilford.com/php/php-random-string-generator-function/)would be suitable for this method.
The final method is to fill a database with a preset number of urls that are all unique and then select the ones with no url assigned to it for the url
02-12-2010, 04:52 AM
I would insert a unique string to the database for it.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.