You can Check for https by:
if ($_SERVER["HTTPS"] == "on") {
//Its https
}
What You Want is:
if (empty($url)) {
echo "Please type a URL";
}
elseif (!preg_match("%https?://%ix", $url) )
$url = 'http://' . $url;
$headers = get_headers($url);