[thelist] Testing for secure connection in PHP

Maximillian Schwanekamp anaxamaxan at neptunewebworks.com
Fri Apr 16 18:44:51 CDT 2004

I've got a credit card payment page that needs to be on a secure connection.
Is there any way to test to make sure that the user has connected to the
page via https?

The only way I can think of is test which server port is used, but I don't
want it to depend on the server config. Is there a more reliable way to test
this in PHP?

AFAIK HTTP SSL connections are *always* on port 443. Thus using the port is
a reliable way to test it across all (or nearly all) servers.  In any case,
that should be true for any normal payment page scenario.

Maximillian Von Schwanekamp
Dynamic Websites and E-Commerce
voice: 541-302-1438
fax: 208-730-6504

More information about the thelist mailing list