Jump to content

Checking SSL with PHP - Not working


ankur0101

Recommended Posts

Hi friends

I have following code

 

function UseOfSSL($domain_name) {
    
$site = ($domain_name);
$port = 443;

$fp = fsockopen($site,$port,$errno,$errstr,10);
if(!$fp)
{
echo "Not Installed";
}

else{
echo "Yes, it is installed";
fclose($fp);
}
}

 

If domain name from $domain_name has installed SSL, it will show it is installed else not installed.

 

Problem is that I tried this with both types of sites, those who are using SSL and those who are not and always, it says Yes, it is installed.

443 is used because https uses port 443

What is the cause ?

Link to comment
https://forums.phpfreaks.com/topic/238205-checking-ssl-with-php-not-working/
Share on other sites

have you tried:

 

$site = 'ssl://'.$domain_name;

 

?

 

Another forum has this code marked as working, although I did not test it, the difference seems to be the ssl:// part.

 

<?php

$SSL_Check = @fsockopen("ssl://www.domain.com/", 443, $errno, $errstr, 30);

if (!$SSL_Check) {

    echo "SSL Not Available";

} else {

    echo "SSL Available";

    fclose($SSL_Check);

}?>

 

hope this helps

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.