473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

PHP: HTTP or HTTPS? How can one tell?

How can I tell if a php page was accessed via http or https?

I already tried this seemingly simple solution, but for me it does not work. How can this be? Any ideas?

[PHP]<?php echo $_SERVER['SERVER_PROTOCOL']; ?>[/PHP]


simply returns:

HTTP/1.1

Whether the page is accessed via http or https.

I never realized this little thing could be such a challange! Any ideas would be greatly appreciated. Thanks!

Elijah

http://www.elijahparker.com
May 7 '06 #1
2 20855
I found it!

[PHP]if($_SERVER['HTTPS'] == on)[/PHP]

Elijah
May 7 '06 #2
I found it!

[PHP]if($_SERVER['HTTPS'] == on)[/PHP]

Elijah
Name-based virtual hosting cannot be used with SSL secure servers because of the nature of the SSL protocol. if you config your apache base on Name-based(More than one web site per IP address), this solution doesn't work.
Apr 22 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Tarapia Tapioco | last post by:
Are there some existing PHP-HTTP-Tunnels? The problem I have: On the computer where I sit it is only possible to access Intranet. But it's also possible to install a PHP-Script there on a...
12
by: Grunff | last post by:
I'm experiencing an interesting problem with carrying a php session over from http to https. Much googling later, I'm still stuck. The application is an online shop, where some user data is...
2
by: MisterKen | last post by:
It appears that I'm losing values for session variables when I move from a page like http://www.my_site.com/catalog.aspx to https://www50.ssldomain.com/my_site/login.aspx and vice versa. Are...
4
by: Chris Ashley | last post by:
Is it possible to persist viewstate information between HTTP and HTTPS (on the same page obviously)? Trying to get around writing some messy state transfer code... it doesn't seem to work if I use...
0
by: Saverio Tedeschi | last post by:
Hi all gurus, I wrote an Win app with embedded FTP client (well, made some cut and paste from others' projects :-)) to receive and send files from within the app itself. Now the server I connect...
0
by: Chuck Anderson | last post by:
How do you make Php be able to open secure streams (see "Registered PHP streams" in the first block of phpinfo() output). I run WAMP on my home PC (Windows XP Pro - Apache 2.0.5.5 - MySQL - and...
4
by: totalstranger | last post by:
My Bluehost site is setup with a dedicated IP address, Rapid SSL certificate, PHP 5 and FastCGI is set on. When switching between HTTP and HTTPS I was under the impression the Session Data was...
0
by: shlim | last post by:
Currently I'm using VB.Net to perform a http/https multipart form post to a servlet. I'm able to perform the post using HttpWebrequest via GetRequestStream(). However, the servlet returned me with...
1
by: Steve | last post by:
weird things afoot. i'd been prototyping a site and had a couple of reports that output in pdf format. everything has been working fine so far. i added in some ssl last night so that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.