Skip to content

Instantly share code, notes, and snippets.

@metashock
Last active August 29, 2015 14:06
Show Gist options
  • Save metashock/e6f090b5f7f930eb79fd to your computer and use it in GitHub Desktop.
Save metashock/e6f090b5f7f930eb79fd to your computer and use it in GitHub Desktop.
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