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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.