I want to get actual URL from tinyurls. I got this script:
<?php
$url = "http://t.co/vpDXYaXl7m";
$full = URLDecode($url);
echo "URL is $full";
function URLDecode($url)
{
$ch = @curl_init($url);
@curl_setopt($ch, CURLOPT_HEADER, TRUE);
@curl_setopt($ch, CURLOPT_NOBODY, TRUE);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$url_resp = @curl_exec($ch);
preg_match('/Location: (.*)\n/', $url_resp, $i);
if (!isset($i[1]))
{
return $url;
}
return $i[1];
}
?>
But it does not respond. Is there any API or other solution for this?