2007-07-21

How to Get the Current Page URL in PHP




function CurrentURL()
{
$url = 'http';

if ($_SERVER["HTTPS"] == "on")
{
$url .= "s";
}

$url .= "://";

if ($_SERVER["SERVER_PORT"] != "80")
{
$url .= $_SERVER["SERVER_NAME"].":".
$_SERVER["SERVER_PORT"].
$_SERVER["REQUEST_URI"];
}
else
{
$url .= $_SERVER["SERVER_NAME"].
$_SERVER["REQUEST_URI"];
}

return $url;
}
?>
Post a Comment