Skip to content

Instantly share code, notes, and snippets.

@kurozumi kurozumi/get_location.php
Last active Aug 29, 2015

Embed
What would you like to do?
短縮URLなどのリダイレクト先のURLを取得する関数
<?php
function get_location($url)
{
$headers = get_headers($url, 1);
if(isset($headers['Location'])){
if(is_array($headers['Location'])){
return array_pop($headers['Location']);
}else{
return $headers['Location'];
}
}else{
return $url;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.