How to identify if a request uses HTTPS?

2

I have to identify if the system that is sending us a request is HTTPS.

if ($isHTTPS){
  #faça alguma coisa
}
else{
 #faça outracoisa
}
    
asked by anonymous 05.05.2017 / 18:38

1 answer

2

As follows:

if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { //HTTPS } 
    
05.05.2017 / 18:41