In the image is a url from apple website. When you run $_SERVER['HTTP_HOST']; you'll get result "www.apple.com" only, no "http://" no "/downloads/dashboard/email_messaging/todo.html"
<?php
$server=$_SERVER['HTTP_HOST'];
echo $server;
?>
You'll get this is result
www.apple.com
When you run this script "$_SERVER['REQUEST_URI']" you'll get the result below, no "http://" and no "www.apple.com
<?php
$request_url=$_SERVER['REQUEST_URI'];
echo $request_url;
?>
This is result when you run $_SERVER['REQUEST_URI']
/downloads/dashboard/email_messaging/todo.html
To get full URL from this site you, we have to use (.) to connect 2 functions together and create http:// by yourself.
<?php
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>
|