Return to Snippet

Revision: 9975
at December 2, 2008 05:52 by sidisinsane


Initial Code
// Returns the full URL of the current document.
function getCurrentUrl() 
{
	// Checks scheme.
	$url = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';	
	// Checks port.
	$url .= ($_SERVER['SERVER_PORT'] != '80') ? $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'] : $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

	// Returns full URL.
	return $url;
}

Initial URL

                                

Initial Description

                                

Initial Title
Get the full URL of current document

Initial Tags
url, php, path

Initial Language
PHP