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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/5/05 2:43 PM, "afan@xxxxxxxx" <afan@xxxxxxxx> 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! :-)


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@xxxxxxxx" <afan@xxxxxxxx> 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.
>>> :)
>>>    
>>> 
>> 
>> 
>> 
>> 
>> 
>>  
>> 

-- 
Marco Tabini
President & CEO

Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada

Phone: +1 (416) 630-6202
Fax: +1 (416) 630-5057

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux