Reverse TinyURL
Join the DZone community and get the full member experience.
Join For Free// Resolves a TinyURL.com encoded url to it's source.
// Example: reverse_tinyurl('http://tinyurl.com/2ocfun') => "http://logankoester.com"
function reverse_tinyurl($url){
$url = explode('.com/', $url);
$url = 'http://preview.tinyurl.com/'.$url[1];
$preview = file_get_contents($url);
preg_match('/redirecturl" href="(.*)">/', $preview, $matches);
return $matches[1];
}
Opinions expressed by DZone contributors are their own.
Comments