
Jasmine
Administrator
May 3, 2000, 6:17 AM
Post #2 of 4
(339 views)
|
|
Re: ho to set up language recognition ?
[In reply to]
|
Can't Post
|
|
One way to try to figure out the language of an individual person visiting your site is to look at the $ENV{'REMOTE_HOST'} variable, which (sometimes) offers the visitor's dialup location. For example, if you see that the visitor is using a .de dialup, chances are that person may speak German. Because of the possible performance issues with resolving ips each time a call to your server is made, your server admin may have turned off the $ENV{'REMOTE_HOST'} variable. To get around this, you can use the following code to get the remote host info anyway: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> if ($ENV{'REMOTE_ADDR'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/){ $Address = pack('C4',$1,$2,$3,$4); $DNS_Address = (gethostbyaddr($Address,2))[0]; $ENV{'REMOTE_HOST'} = $DNS_Address if $DNS_Address; } $ENV{'REMOTE_HOST'} =~ tr/[A-Z]/[a-z]/; </pre><HR></BLOCKQUOTE> Good luck!
|