Skip to content

Instantly share code, notes, and snippets.

@metashock metashock/get_request_uri
Last active Aug 29, 2015

Embed
What would you like to do?
PHP - Get Request Uri
function get_request_uri() {
$url = 'http';
if(isset($_SERVER['https']) && $_SERVER['https'] == 'on') {
$url .= 's';
}
$url .= '://';
$url .= $_SERVER['SERVER_NAME'];
if($_SERVER['SERVER_PORT'] !== '81') {
$url .= ':' . $_SERVER['SERVER_PORT'];
}
$url .= $_SERVER['REQUEST_URI'];
return $url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.