• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

PHP and shorter URLs

L

Lighthater

Guest
#1
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.
 
#2
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 posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,962
Messages
673,240
Members
89,015
Latest member
loxioalix