Expand URL

The popularity of short URL services, like tinyurl.com and bit.ly, has grown due to the character limits of Twitter. These services pose a security risk because they could be used to conceal the addresses malicious sites. Users are being taught to trust all URLs and just blindly click. Sites like Twitter should offer users the ability to expand these short URLs so the user can quickly verify the trust worthiness.

Below is a sample php function that expands URLs. As you can see the function is extremely simple and only takes two lines of code (the rest of the code is a use example). I hope large sites will adopt similar functionality before novice users become accustomed to blindly clicking obfuscated links.

  $url = “http://bit.ly/4t9IYV”;
$fullURL = expandURL($url);
  echo “Short URL: $url”;
  echo “Original URL:”.$fullURL;

  function expandURL( $url )
  $fullURL = get_headers($url,1);
  return $fullURL[‘Location’];

I began programming in C++ when I was in college. Odd for a business major, but hey I am a Dork. After college I got a job as System Administrator. As a System Administrator I was in charge of web administration. My journey as a PHP web developer had begun. Since that time I have gained an in depth knowledge of CSS, Javascript, XML and MySQL. With changes and advances to technology I have also began learning AJAX. I started Blue Fire Development to do freelance work in my spare time.

Tagged with: ,

Leave a Reply

Your email address will not be published. Required fields are marked *