Just wondering if it is possible, we can check if the page is a call from http or https in php?
Example: If I call the customer.php page at the following link http: //customer.php , it will be possible to check php and report that the page is from http .. also if I call the page from the following link https: //customer.php , it will be possible to check php and report that the page is from https ??
Try to see:
if (!empty($_SERVER['HTTPS'])) { // https is enabled }
you can also check $_SERVER['SERVER_PORT']how here
$_SERVER['SERVER_PORT']
HTTP-URL, "http://" 80 URL- HTTPS "https://" 443 .
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { // do stuff }
If the request was sent using HTTPS, you will have an additional parameter in $_SERVERsuperglobal - $_SERVER['HTTPS'].. You can check if it is installed or not.
$_SERVER
- $_SERVER['HTTPS'].
if( isset($_SERVER['HTTPS'] ) ) {