Re: how to check http:// or https:// ?

From: Date: Fri, 05 Aug 2005 19:24:29 +0000
Subject: Re: how to check http:// or https:// ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220101@lists.php.net to get a copy of this message
Marco Tabini wrote:
On 8/5/05 2:43 PM, "afan@afan.net" <afan@afan.net> wrote:
Thanks Marco! :) I was looking for something like this on phpinfo() but didn't found?
That's because it shows up only if you are under HTTPS! :-)
AFAICT tell you should check whether the value is actually set to 'on' (IIRC a post by Rasmus): e.g. if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { echo 'you are secure(-ish?)'; } SIDENOTE REGARDING BEEBLEX.COM: I just added a bookmark in firefox to beeblex.com as follows http://beeblex.com/search.php?d=ALLDB&s=%s and I gave it a keyword of 'beeb' now I can go to firefox and type 'beeb HTTPS' to get an direct hit - so now there is no excuse not to be using Marco's cool new resource :-)
Marco
-afan Marco Tabini wrote:
IIRC, if you're using Apache you can check If (isset ($_SERVER['HTTPS'])) You can also check this thread: http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP S%27%5D -- BeebleX - The PHP Search Engine http://beeblex.com On 8/5/05 2:05 PM, "afan@afan.net" <afan@afan.net> wrote:
Hi, I need to check does URL use http or https? Right now I use this code: if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) { header('location: [URL]https://www.test.com/test.php[/URL]'); exit; } but I am sure there is much better solution. :)


« previous php.general (#220101) next »