This is the solution for your problem:
//Fetch page URL by this
$url = $_SERVER['REQUEST_URI'];
echo "$url
";
//It will print
//fetch host by this
$host=$_SERVER['HTTP_HOST'];
echo "$host
";
//You can fetch the full URL by this
$fullurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $fullurl;