Level 11
Ok I found a solution with Guzzle, if anyone else needs it or wants to improve it :
function getFullUrl($domain)
{
$request = (new GuzzleHttp\Client)->request('GET', $domain, [
'allow_redirects' => [
'track_redirects' => true
]
]);
$redirections = $request->getHeaderLine('X-Guzzle-Redirect-History');
$redirections = explode(',', $redirections);
return trim(end($redirections));
}
1 like