Skip to content

Instantly share code, notes, and snippets.

@fhferreira
Last active December 27, 2015 16:09
Show Gist options
  • Save fhferreira/7353444 to your computer and use it in GitHub Desktop.
Save fhferreira/7353444 to your computer and use it in GitHub Desktop.
Capturar URL completa
<?php
function getURLFull() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment