79501529

Date: 2025-03-11 16:59:57
Score: 0.5
Natty:
Report link

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";
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Tom Saxton