Thanks to Alix for the general solution. Here's a version that doesn't depend on the Location header being in a fixed position.
$context = array
(
'http' => array
(
'method' => 'GET',
'max_redirects' => 1,
)
);
@file_get_contents('https://YOUR-SHORTCUT-URL', null, stream_context_create($context));
$urlRedirect = NULL;
foreach ($http_response_header AS $header)
{
$rec = explode(': ', $header);
if (count($rec) == 2 && $rec[0] == 'Location')
$urlRedirect = $rec[1];
}
if ($urlRedirect != NULL)
echo "redirects to $urlRedirect";