identify visitor's country

This is a discussion on identify visitor's country within the PHP Language forums, part of the PHP Programming Forums category; Hi Is there any (preferably free) PHP script that will identify the country of a visitor, thus allowing one page ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-29-2004
abracad
 
Posts: n/a
Default identify visitor's country

Hi

Is there any (preferably free) PHP script that will identify the
country of a visitor, thus allowing one page to be delivered to those
from A, B and C, and another to those from X, Y and Z?

Thanks
Reply With Quote
  #2 (permalink)  
Old 11-29-2004
Chris Hope
 
Posts: n/a
Default Re: identify visitor's country

abracad wrote:

> Is there any (preferably free) PHP script that will identify the
> country of a visitor, thus allowing one page to be delivered to those
> from A, B and C, and another to those from X, Y and Z?


Have a look at http://ip-to-country.com/

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Reply With Quote
  #3 (permalink)  
Old 11-29-2004
Phillip Parr
 
Posts: n/a
Default Re: identify visitor's country

Head on over to http://www.ip-to-country.com, you can download a CSV of IP
ranges per country (and the info on how to do it).

Phil


"abracad" <abracad_1999@yahoo.com> wrote in message
news:e14ddf84.0411282322.7c4d0d28@posting.google.c om...
> Hi
>
> Is there any (preferably free) PHP script that will identify the
> country of a visitor, thus allowing one page to be delivered to those
> from A, B and C, and another to those from X, Y and Z?
>
> Thanks



Reply With Quote
  #4 (permalink)  
Old 11-29-2004
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: identify visitor's country

abracad_1999@yahoo.com (abracad) wrote in message news:<e14ddf84.0411282322.7c4d0d28@posting.google. com>...
> Hi
>
> Is there any (preferably free) PHP script that will identify the
> country of a visitor, thus allowing one page to be delivered to those
> from A, B and C, and another to those from X, Y and Z?


http://ip-to-country.webhosting.info/

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com
Reply With Quote
  #5 (permalink)  
Old 11-30-2004
Andy Jacobs
 
Posts: n/a
Default Re: identify visitor's country

In article <e14ddf84.0411282322.7c4d0d28@posting.google.com >,
abracad_1999@yahoo.com (abracad) wrote:

> Hi
>
> Is there any (preferably free) PHP script that will identify the
> country of a visitor, thus allowing one page to be delivered to those
> from A, B and C, and another to those from X, Y and Z?
>
> Thanks


Isn't that a bit dangerous? What about Switzerland? Or the US where
loads of languages are used.

Would it not be better to use content negotiation to determine the
language that is actually being used on the machine?

A
Reply With Quote
  #6 (permalink)  
Old 11-30-2004
Gordon Burditt
 
Posts: n/a
Default Re: identify visitor's country

>> Is there any (preferably free) PHP script that will identify the
>> country of a visitor, thus allowing one page to be delivered to those
>> from A, B and C, and another to those from X, Y and Z?
>>
>> Thanks

>
>Isn't that a bit dangerous? What about Switzerland? Or the US where
>loads of languages are used.


Language may not be the issue, or be the only issue.
It could be a matter of directing the visitors to the
appropriate office in the same country (or one nearby),
showing them the warranty applicable to their country,
showing prices in their currency, etc.

>Would it not be better to use content negotiation to determine the
>language that is actually being used on the machine?


You may want to use both together.

Gordon L. Burditt
Reply With Quote
  #7 (permalink)  
Old 11-30-2004
John Dunlop
 
Posts: n/a
Default Re: identify visitor's country

Andy Jacobs wrote:

> [abracad wrote:]


> > Is there any (preferably free) PHP script that will identify the
> > country of a visitor, thus allowing one page to be delivered to those
> > from A, B and C, and another to those from X, Y and Z?


> Isn't that a bit dangerous?


Though I don't imagine anything perilous about guessing
incorrectly the country a reader is in, I look upon country-
guessing as harmful. That a reader becomes frustrated when
you guess wrongly should be sufficient grounds for your
guessing to stop. The only obstacle is a hypertrophied ego.

> What about Switzerland? Or the US where loads of languages are used.


Oh, languages. That is a practice to be discouraged. I
would give abracad the benefit of the doubt, however, and
assume that their intention was not to serve resources in
different languages depending on the country the reader is
thought to be in, but to instead use the information for
another, unstated purpose.

Determining a reader's country (whatever 'country' means
here) might or might not work; worse still, who knows when
it fails? The question 'Can I determine the reader's
country?' is posed now and again in the web authoring
groups; the followups consistently begin with the word 'no'.

> Would it not be better to use content negotiation to determine the
> language that is actually being used on the machine?


Yes, you might say that.

Cheers!

--
Jock
Reply With Quote
  #8 (permalink)  
Old 11-30-2004
Chris Hope
 
Posts: n/a
Default Re: identify visitor's country

John Dunlop wrote:

> Determining a reader's country (whatever 'country' means
> here) might or might not work; worse still, who knows when
> it fails?**The*question*'Can*I*determine*the*reader's
> country?' is posed now and again in the web authoring
> groups; the followups consistently begin with the word 'no'.


You can generally get the country from the user's IP address pretty
successfully. However, the databases are sometimes wrong or incomplete,
and the user may be going through a proxy in another country which
effectively masks them and makes out like they're in a country they are
not.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Reply With Quote
  #9 (permalink)  
Old 12-01-2004
John Dunlop
 
Posts: n/a
Default Re: identify visitor's country

Chris Hope wrote:

> You can generally get the country from the user's IP address pretty
> successfully.


I do not dispute that. I'm not a statistician. The service
you suggested, IP-to-Country.com, claim to be about 98 %
accurate.

But do you agree that automatically guessing what country a
reader is in is not infallible? That is what I was trying
to get at. Is the risk of getting it wrong not enough for
you to change your approach?

> However, the databases are sometimes wrong or incomplete,
> and the user may be going through a proxy in another country which
> effectively masks them and makes out like they're in a country they are
> not.


When you're right, you're right, Chris!

--
Jock
Reply With Quote
  #10 (permalink)  
Old 12-01-2004
Chris Hope
 
Posts: n/a
Default Re: identify visitor's country

John Dunlop wrote:

>> You can generally get the country from the user's IP address pretty
>> successfully.

>
> I do not dispute that.**I'm*not*a*statistician.**The*service
> you suggested, IP-to-Country.com, claim to be about 98 %
> accurate.
>
> But do you agree that automatically guessing what country a
> reader is in is not infallible?**That*is*what*I*was*trying
> to get at.**Is*the*risk*of*getting*it*wrong*not*enough*fo r
> you to change your approach?


It all depends to what purpose you are trying to determine their
country. I currently only use ip-to-country for reporting purposes to
get some idea of where in the world visitors to my sites are coming
from. I may use it in the future to automatically select which country
is preselected in a drop down box or which currency to use, but then
again I may not.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:24 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0