I suggest you look into the content of $_SERVER array.
(use something like
<?php print_r($_SERVER); ??>
Look at the various values in this array and decide which one is good for you.
Another option is to use javaScript and the location.(various stuff) and transmit that to the server (how depends upon what you wish to do with it).