http vs https
am 23.01.2010 18:11:09 von Ben Miller
------=_NextPart_000_0010_01CA9C14.638574D0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Is there a PHP function that will return whether the request was http or
https? I have functions that need to cURL other servers - sometimes over
SSL, sometimes not, depending whether the function is called from
http://www.mydomain.com/script_that_calls_function.php or
https://www.mydomain.com/script_that_calls_function.php
Hope the question is clear. Thanks,
Ben
------=_NextPart_000_0010_01CA9C14.638574D0--
Re: http vs https
am 23.01.2010 18:44:57 von Nathan Rixham
Ben Miller wrote:
> Is there a PHP function that will return whether the request was http or
> https? I have functions that need to cURL other servers - sometimes over
> SSL, sometimes not, depending whether the function is called from
> http://www.mydomain.com/script_that_calls_function.php or
> https://www.mydomain.com/script_that_calls_function.php
>
> Hope the question is clear. Thanks,
>
$_SERVER['HTTPS']
Set to a non-empty value if the script was queried through the HTTPS
protocol.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: http vs https
am 23.01.2010 18:45:13 von Jonathan Tapicer
Hi,
isset($_SERVER['HTTPS']) should do it.
Regards,
Jonathan
On Sat, Jan 23, 2010 at 2:11 PM, Ben Miller wrote:
> Is there a PHP function that will return whether the request was http or
> https? =A0I have functions that need to cURL other servers - sometimes ov=
er
> SSL, sometimes not, depending whether the function is called from
> http://www.mydomain.com/script_that_calls_function.php or
> https://www.mydomain.com/script_that_calls_function.php
>
>
>
> Hope the question is clear. =A0Thanks,
>
>
>
> Ben
>
>
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: http vs https
am 23.01.2010 19:08:23 von Adam Richardson
--00148531a4c46aef45047dd8d24e
Content-Type: text/plain; charset=ISO-8859-1
Just as a warning, I have worked on linux servers where this did not work,
perhaps because of what silverquick points out:
http://www.php.net/manual/en/reserved.variables.server.php
I think the HTTPS element will only be present under Apache 2.x. It's not in
> the list of "special" variables here:
> http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#Rewrit eCond
But it is here:
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewrit econd
Again, not sure that was the issue, but I know there have been some linux
servers that didn't provide this information, so make sure you test it out
well.
Adam
On Sat, Jan 23, 2010 at 12:44 PM, Nathan Rixham wrote:
> Ben Miller wrote:
> > Is there a PHP function that will return whether the request was http or
> > https? I have functions that need to cURL other servers - sometimes over
> > SSL, sometimes not, depending whether the function is called from
> > http://www.mydomain.com/script_that_calls_function.php or
> > https://www.mydomain.com/script_that_calls_function.php
> >
> > Hope the question is clear. Thanks,
> >
>
> $_SERVER['HTTPS']
> Set to a non-empty value if the script was queried through the HTTPS
> protocol.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com
--00148531a4c46aef45047dd8d24e--