I have a curl based function in php to check if a website is online that works fine however i have noticed that it only works for http links and not https links.
Does anyone know how this function can be updated to support https links also.
function isDomainAvailible($domain){
// Check, if a valid url is provided
if(!filter_var($domain, FILTER_VALIDATE_URL)){
return false;
}
// Initialize curl
$curlInit = curl_init($domain);
curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($curlInit,CURLOPT_HEADER,true);
curl_setopt($curlInit,CURLOPT_NOBODY,true);
curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
// Get answer
$response = curl_exec($curlInit);
curl_close($curlInit);
if ($response){
return true;
} else {
return false;
}
}