Re: Countries and ip addresses

From: Date: Mon, 20 Aug 2001 09:03:32 +0000
Subject: Re: Countries and ip addresses
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63470@lists.php.net to get a copy of this message
It's not possible to be assured of doing this properly for the following reason.. 1. not all hosts translate to IP address 2. Soem host names are often meaningless (eg .com) The way to do it is basically this 1. use gethostbyaddr() (http://www.php.net/gethostbyaddr) to do a reverse DNS from IP to host name 2. use a regex to match everything to the right of the last . 3. Look that value up in some table of countries eg. notam.uio.no to no to norway HTH, Tom ----- Original Message ----- From: "Mihailo Dzigurski" <mdzigurski@yahoo.com> To: <php-general@lists.php.net> Sent: Monday, August 20, 2001 9:57 AM Subject: [PHP] Countries and ip addresses > Hello, > > How can I find out from witch country user is based on user ip address? I > need this from php script. > > Thanks, > Mihailo. > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#63470) next »