zoxon
5/1/2014 - 8:33 AM

PHP: Get current URL

PHP: Get current URL

function checkHTTPS() {
	if(!empty($_SERVER['HTTPS'])) {
		return ($_SERVER['HTTPS'] !== 'off') ? true : false;
	}
	else {
		return ($_SERVER['SERVER_PORT'] == 443) ? true : false;
	}
}

function getCurURI(){
	$uri = (checkHTTPS()) ? 'https://' : 'http://';
	$uri .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	return $uri;
}