Re: [PHP] How to find out what country the visitor comes from
One you have the IP you need to do a whois on the RIPE database to work out who the IP is assigned to and which country they are in. -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 PGP Key available, send email with subject: Send PGP Key - Original Message - From: SED [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 12:11 PM Subject: [PHP] How to find out what country the visitor comes from Hi, I'm trying to find out what country the visitor comes from to offer them suitable language (like google.com does) but I haven't found a method that works 100%. What I have come up with so far is to use $HTTP_X_FORWARDED_FOR or gethostbyaddr($REMOTE_ADDR) Sometime I get domain which does the job (and that works) but often I get just IP number which leaves me out in the cold. Is there any other way to capture the visitors country? Thanks, SED -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find out what country the visitor comes from
The way Google determines what language to use is by checking the Accept-Language header which is added by your browser. The value of this request header is stored automatically in the $_SERVER array. Check with phpinfo() or print_r($_SERVER); Although IP may be more reliable to determine the local language of the visitor's country, it may not at all be the *preferred* language of the visitor. This way the user still has full control over what language is used through browser settings. bvr. On Fri, 8 Feb 2002 12:56:52 -, Jon Farmer wrote: One you have the IP you need to do a whois on the RIPE database to work out who the IP is assigned to and which country they are in. I'm trying to find out what country the visitor comes from to offer them suitable language (like google.com does) but I haven't found a method that works 100%. What I have come up with so far is to use $HTTP_X_FORWARDED_FOR or gethostbyaddr($REMOTE_ADDR) Sometime I get domain which does the job (and that works) but often I get just IP number which leaves me out in the cold. Is there any other way to capture the visitors country? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to find out what country the visitor comes from
Hi, I'm trying to find out what country the visitor comes from to offer them suitable language (like google.com does) but I haven't found a method that works 100%. What I have come up with so far is to use $HTTP_X_FORWARDED_FOR or gethostbyaddr($REMOTE_ADDR) Sometime I get domain which does the job (and that works) but often I get just IP number which leaves me out in the cold. Is there any other way to capture the visitors country? Thanks, SED -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find out what country the visitor comes from
Hi: SED wrote: I'm trying to find out what country the visitor comes from to offer them suitable language $HTTP_X_FORWARDED_FOR or gethostbyaddr($REMOTE_ADDR) Domain names and IP's are NOT the way to go. Way to unreliable. Use the HTTP header HTTP_ACCEPT_LANGUAGE. Take it easy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php