I dont have the documentation in front of me but there is an array that holds a lot of that information built into php. I really cant think of what it is but its something like HTTP_VARS[]
and a lot of the data in it is like: hostname, ip address, site they are coming from, link they used to get here, etc... look into it