How can I fetch the url witch is the address to the script currently running?
regards tores
Gettting the current url
Moderator: General Moderators
this is the function i found here (or somewhere else)
Code: Select all
function geturl()
{
$ports = array('https' => 443, 'http' => 80);
$prefix = empty($_SERVER['HTTPS']) ? 'http' : 'https';
$url = $prefix;
$url .= $_SERVER['SERVER_PORT'] != $ports[$prefix] ? ':' . $_SERVER['SERVER_PORT'] : '';
$url .= '://';
$url .= $_SERVER['HTTP_HOST'];
$url .= $_SERVER['REQUEST_URI'];
return $url;
}
echo geturl();