Why domain.com appears as theplant.com when hosted on hostgator?

Posted by silow on Server Fault See other posts from Server Fault or by silow
Published on 2011-02-10T11:35:52Z Indexed on 2012/08/27 21:42 UTC
Read the original article Hit count: 223

Filed under:
|
|

I have a script that's supposed to detect the url of its caller website. If the caller is another website, it should give something like http://callersite.com. I'm using this line of php code (though I suspect this won't matter for sysadmins)

gethostbyaddr($_SERVER['REMOTE_ADDR'])

I'm testing with a caller site that's hosted on hostgator. What I'm noticing though is that I don't get callersite.com, I get something like 1a.12.12ab.static.theplanet.com. I don't know what theplanet.com is and why I'm not getting caller site.com.

Also what do I need to do to really get the domain of the site making a call to my script?

--

Thanks for the explanation. Some have advised I use $_SERVER['HTTP_REFERER'] but it's not what I'm after. My script acts as an API. Another website makes a curl request to it and gets an output and later on presents it to the user. So http referrer gives false since the caller site.com is making a direct call to me. So any hope?

© Server Fault or respective owner

Related posts about apache2

Related posts about webserver