Доброе время;Вам необходимо получить доступ к функции curl для тех, у кого https протестировать ее:
function get_redirect_final_host_url($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // follow redirects
curl_setopt($ch, CURLOPT_AUTOREFERER, 1); // set referer on redirect
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // get access ssl
curl_exec($ch);
$target = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
curl_close($ch);
$website_host_url = str_ireplace('www.', '', parse_url($target)['host']);
return $website_host_url;
}