php - methods for determining if traffic is through https or http -


I need a simple task to decide whether it's using https or http I'm thinking Was - is there a way to use the PHP port #? So if it's 443, I know that it's safe, and if it's 80, then I know it's normal.

What are other ways to determine this?

  & lt ?? Php if ($ _ server ['HTTPS']) {// secure} other {// not secure}? & Gt;   

However some servers do not set up HTTPS, so in the worst case:

     

Comments