Re: [PHP] Countries and ip addresses

2001-08-20 Thread speedboy

 How can I find out from witch country user is based on user ip address? I
 need this from php script.

You can't. You can try with their hostname.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Countries and ip addresses

2001-08-20 Thread Tom Carter

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 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]