I want to redirect a page under SSL if this is available or display an error page if not.
My code is as follow:
if ($fp = fsockopen("www.company.com",443))
{
header("location: https://www.company.com/some_page.php");
exit;
}
else
{
header("location: error_page.php");
exit;
}
These codes work for me for some domains but not for some others. Is there a better way to do this?
Any comment / help is appreciated.