I think, you need this one:
<?php
function getTrueURL($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
$data = curl_getinfo($ch);
return $data["url"];
}
echo getTrueURL("http://tinyurl.com/5b2su2");
?>