Last active
August 29, 2015 14:00
-
-
Save zoxon/107c0b8bf31fb892d492 to your computer and use it in GitHub Desktop.
PHP: Get current URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkHTTPS() { | |
if(!empty($_SERVER['HTTPS'])) { | |
return ($_SERVER['HTTPS'] !== 'off') ? true : false; | |
} | |
else { | |
return ($_SERVER['SERVER_PORT'] == 443) ? true : false; | |
} | |
} | |
function getCurURI(){ | |
$uri = (checkHTTPS()) ? 'https://' : 'http://'; | |
$uri .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; | |
return $uri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment