//get_headers follows redirects automatically
$headers = get_headers($url, 1);
if ($headers !== false && isset($headers['Location'])) {
//get_headers follows redirects automatically
$headers = get_headers($url, 1);
if ($headers !== false && isset($headers['Location'])) {