Get the Current URL of Page with PHP

This simple snippet of code will help you get the full URL of the currently viewed page.

function getUrl(){
	$domain = $_SERVER['HTTP_HOST'];
	$url = "http://" . $domain . $_SERVER['REQUEST_URI'];
 	return $url;

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.