Forum Moderators: coopster & phranque

Message Too Old, No Replies

Remote host not available

$ENV{'REMOTE_HOST'} is blank.

         

theperlyking

2:14 pm on Jul 8, 2001 (gmt 0)

10+ Year Member



My tracking script uses $ENV{'REMOTE_HOST'} for the remote address the visitor has come from, my problem is one of my hosts has it and the other two dont. Its helpful being able to see the host details as it gives you more information at a glance than just the IP does.

Before I contact the hosting companies I thought I would ask if anyone knows a way I can


  • Configure my account/htaccess/whatever to start reporting the HOST.
  • Use a different ENV variable for the same purpose (short of looking up each IP address :) )

Thanks :)

bobriggs

2:36 pm on Jul 8, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



perly, I don't think you can do it in .htaccess, it will have to be a server config or in the virtual host directives:

[apache.org...]

theperlyking

2:47 pm on Jul 8, 2001 (gmt 0)

10+ Year Member



Thanks that was exactly what I was looking for, i'll get in touch with the hosts.

Brett_Tabke

3:00 pm on Jul 14, 2001 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



A small snip to resolve hostnames from your script on the fly:

($ckspa,$ckspb,$ckspc,$ckspd)=split(/\./,$ENV{REMOTE_ADDR});
$ckspipadr=pack("C4",$ckspa,$ckspb,$ckspc,$ckspd);
($hostname,$ckspaliases,$ckspaddrtype,$cksplength,@spaddrs)=(gethostbyaddr("$ckspipadr", 2));

The hostname is now in $hostname;

However, host lookups can take some time.

theperlyking

7:26 pm on Jul 14, 2001 (gmt 0)

10+ Year Member



I suspect thats more elegant than using backticks and the whois command :) <-- the way I do it in another script.

Happily I dont have to worry about it any more, my host has enabled this now.

Brett_Tabke

6:28 pm on Jul 17, 2001 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



A host turned it on one box after I asked and never told me. I spent the next year resolving them on the fly like the above. Luckily, since they had it turned on, atleast the dns info would be cached along the route.