Forum Moderators: coopster

Message Too Old, No Replies

Http_host

         

ScottYardley

2:35 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



I wrote a script to track multible websites.
It (among other things) tracks the domain name.

Sometimes the domain name isn't tracked. This realy concerns me because it is server side track. These clients are also hidding the UserAgent...Im not concerned about this because it is deliever by the client (easily spoofed)

I get the domain using php with the code:
$_SERVER["HTTP_HOST"]

I know the issue is not because the the client is pulling by IP, tested that and the ip is recorded as domain. Does $_SERVER["HTTP_HOST"] pull its info from the webserver?

Does anybody have any idea? I would appreciated any help.

charlier

2:56 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



Not sure what it could be. Do you mean you took the remote host IP and looked it up and it resolved? It may be that Apache hasn't resolved the remote host domain when it calls your script, I suspect if it takes too long then it probably doesn't do it in real time as that would slow down the server response. You could do your own lookup using php's gethostbyaddr() function. Of course if they don't have a reverse lookup record then you can't get the name from that.

ScottYardley

3:07 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



I'm not looking for the REMOTE host. Im looking for the LOCAL host. Im looking for the domain name of the website that is delivering the webpage. The domain name of my websites (I have more than one).

Im using the server variables: $_SERVER via php:
[us4.php.net...]

coopster

3:29 pm on Oct 6, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



See message number two in HTTP_HOST vs SERVER_NAME [webmasterworld.com].

ScottYardley

9:27 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



Thanks that took care of it.
So HTTP_HOST comes from the clients dns
and SERVER_NAME is the configuration of the server.

Out of curiosity my buddy duplicated this.
To do this he just added a line on his dns server pointing yahoo.com to my ip. After that he type yahoo.com on his browser, it pull up my site and my sript recorded the HTTP_HOST as yahoo.com

I understand why a client whould want to hide client side information, but why would someone want to spoof the server side info? I had four ip address do this.

jdMorgan

10:29 pm on Oct 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You may have had problems because some clients were using HTTP/1.0, which does not provide the Hostname request header tested by HTTP_HOST.

Note that some user-agents which advertise HTTP/1.0 are actually HTTP/1.1 compliant, and *do* provide the Hostname header. So, it's not consistent, but HTTP/1.0 technically does not define that header.

Jim