Skip to content

Instantly share code, notes, and snippets.

@takimo
Created November 26, 2011 05:31
Show Gist options
  • Select an option

  • Save takimo/1395093 to your computer and use it in GitHub Desktop.

Select an option

Save takimo/1395093 to your computer and use it in GitHub Desktop.
t.co decode
function tcoDecode($contentData){
$strPattern = "http:\/\/t\.co\/.+";
if(preg_match('/'.$strPattern.'/m', $contentData, $matches)>0)
{
$headers = get_headers($matches[0]);
$contentData = preg_replace("/".$strPattern."/",$headers["Location"],$contentData);
}
return $contentData;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment