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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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/ |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
>> 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 |
|
|||
|
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 |
|
|||
|
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/ |
|
|||
|
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 |
|
|||
|
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/ |