Home / PHP Tips Generated By ChatGPT / Checking for HTTPS in PHP Check if the current request is made over HTTPS. Source Code if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') { echo "This is a secure HTTPS connection."; } else { echo "This connection is not secure. Please use HTTPS."; }