Page 1 of 1

Check if SSL is available

Posted: Fri Aug 26, 2005 5:52 am
by hopfateam
I would wrote a CMS which allows admins to either use SSL or regular http

The problem is that not all providers support SSL (especially on shared hostings):

i would like to check if SSL is supported or not:

e.g:
User installed CMS on http://www.domain.com
atm I offer a link with https://www.domain.com to see if ssl works

But I´m not satisfied with this

Is there a way to check if SSL is supoorted or not?!

Something link $_ENV[] or else?!

:?: :idea:

Posted: Fri Aug 26, 2005 7:12 am
by feyd
first, check if ssl is supported in the list of wrappers, then try creating a link to it in code. Set the timeout to quite short. If you get a page response, it's got it enabled in some fashion.

If you're running Apache, the Apache functions in php may help. The $_SERVER superglobal may also have some details, but not as likely.

Posted: Fri Aug 26, 2005 11:42 am
by hopfateam
THX, for the reply feyd

SERVER_SIGNATURE might work, don´t you think?!
I mean, it the only variable, which considers to contain information about ssl... :oops:

At my xampp it shows
"Apache/2.0.53 (Win32) mod_ssl/2.0.53 OpenSSL/0.9.7f PHP/5.0.4 Server at localhost Port 80"

While it doesnot show anything like this at my webspace @ lycos (shared hosting without SSL-Support)

Posted: Fri Aug 26, 2005 12:02 pm
by hopfateam
nice script to echo all superglobals

Code: Select all

<?php $var=$_ENV;
$var_array=array($_COOKIE,$_ENV,$_FILES,$_GET,$_POST,$_REQUEST,$_SESSION,$_SERVER);
$var_array1=array('$_COOKIE','$_ENV','$_FILES','$_GET','$_POST','$_REQUEST','$_SESSION','$_SERVER');

?>
<?php
foreach($var_array as $vartitle =>$varvalue){
echo"<h2>$var_array1[$vartitle]</h2> <hr />";

foreach($varvalue as $title1 =>$value1){

echo"$title1 == $value1 <br>";
}}
 ?>