PHP and shorter URLs

Discussion in 'Web Design & Coding' started by Lighthater, Dec 3, 2002.

  1. Lighthater

    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, which does this already, however I would like to put this on our intranet site.

    Thanks for any help you can give.
  2. Zedric

    Zedric NTFS Guru Folding Team

    Well if you have some database storage to spare I think I can give you a tip:
    $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.