Skip to content

Instantly share code, notes, and snippets.

@binarykore
Created June 6, 2022 07:16
Show Gist options
  • Select an option

  • Save binarykore/3ff9d7fe8cce6aa80b9a91895c4ec6e4 to your computer and use it in GitHub Desktop.

Select an option

Save binarykore/3ff9d7fe8cce6aa80b9a91895c4ec6e4 to your computer and use it in GitHub Desktop.
Prints either HTTP or HTTPs...
<?php
if(!empty($_SERVER["REQUEST_SCHEME"])){
$_scheme = $_SERVER["REQUEST_SCHEME"];
}elseif(empty($_SERVER["REQUEST_SCHEME"])){
$_scheme = $_SERVER["HTTP_X_FORWARDED_PROTO"];
}
echo($_scheme);
//Prints either HTTP or HTTPs
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment