Convert shortened URL back to original URL

<?php
function getNormalUrl($url) {
	$url = trim($url);
	$h = get_headers($url, true);
	return $h['Location'];
}
?>

Download this snippet

This PHP function takes a shortened URL (ie TinyURL, bit.ly, etc) and converts it back to the original URL.

Twitter Twitter

6 Comments to “ Convert shortened URL back to original URL”

  1. Anonymous  on Sep 04, 2009

    sooljf <a href="http://wybjjjmqmdhw.com/">wybjjjmqmdhw</a>, [url=http://puzbezugqnqs.com/]puzbezugqnqs[/url], [link=http://rwlffhkycqnf.com/]rwlffhkycqnf[/link], http://otlxotongqlj.com/

  2. Anonymous  on Sep 25, 2009

    VH5c2n <a href="http://debkkwpikbqu.com/">debkkwpikbqu</a>, [url=http://aopsvvnwjriv.com/]aopsvvnwjriv[/url], [link=http://thjwocvdyvkb.com/]thjwocvdyvkb[/link], http://eqwggvogwuwe.com/

  3. Anonymous  on Nov 04, 2009

    SYUvX0 <a href="http://omlumkjleffp.com/">omlumkjleffp</a>, [url=http://ggnvmjpdqbak.com/]ggnvmjpdqbak[/url], [link=http://ublyvvuvkakl.com/]ublyvvuvkakl[/link], http://azgdkxaalkgk.com/

  4. Anonymous  on Jan 13, 2010

    qKrBSy <a href="http://qktppfmlwojm.com/">qktppfmlwojm</a>, [url=http://borcvjnkeaac.com/]borcvjnkeaac[/url], [link=http://hwkvbnnbtowz.com/]hwkvbnnbtowz[/link], http://vlktlouowpny.com/

  5. Anonymous  on Jan 22, 2010

    aLFqwV <a href="http://wtmtvxxmwnrj.com/">wtmtvxxmwnrj</a>, [url=http://bdhbjslzvlax.com/]bdhbjslzvlax[/url], [link=http://psmydlakzine.com/]psmydlakzine[/link], http://hbqfuekopnzm.com/

  6. Anonymous  on Mar 14, 2010

    hSNXwf <a href="http://lpftjgyfqljr.com/">lpftjgyfqljr</a>, [url=http://eqnaepoioqty.com/]eqnaepoioqty[/url], [link=http://ncmydghtzhpe.com/]ncmydghtzhpe[/link], http://inhvezgcywnk.com/

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>