PHP and shorter URLs

L

Lighthater

Guest
I am wondering if anyone knows of a way to create shorter URLs from larger ones using PHP? I am not very good with PHP, but here at work we use REALLY long URLs and a lot of times the URLs break in email. Unforutnately, I have no control over the creation of these URLs, but I would like to have a tool to shorten them in case there are problems with the links breaking. I found tinyurl.com, which does this already, however I would like to put this on our intranet site.

Thanks for any help you can give.
 
Well if you have some database storage to spare I think I can give you a tip:
PHP:
$big_phat_url = "http://verrrrry.long.url/";

$db_key = md5($big_phat_url);    //Generates a 32 char key
$short_url = "http://server/path/short_url.php?url=" . $db_key;
Store the $db_key and $big_phat_url in the database and send the $short_url in the email.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back