473,382 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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
Jul 17 '05 #1
11 8414
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/
Jul 17 '05 #2
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" <ab**********@yahoo.com> wrote in message
news:e1**************************@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

Jul 17 '05 #3
ab**********@yahoo.com (abracad) wrote in message news:<e1**************************@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
Jul 17 '05 #4
In article <e1**************************@posting.google.com >,
ab**********@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
Jul 17 '05 #5
>> 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
Jul 17 '05 #6
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
Jul 17 '05 #7
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/
Jul 17 '05 #8
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
Jul 17 '05 #9
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/
Jul 17 '05 #10
I'd like to also another point to the argument. websites which make no
attempt to tell where you're from and let you use their site, even if you
couldn't possibly do anything with it are offensive to me. For example:

let's say I want to buy something, so I find a shop that sells what i want.
I realise that they are accepting dollars and not pounds, which is fair
enough. However, I only find out they won't ship to me when they request a
zip-code and go on to tell me I don't exist. IMO websites that only cater
for one group of people (ie: americans) should clearly state on their front
page that the site is for use of those people only.

Phil

"John Dunlop" <us*********@john.dunlop.name> wrote in message
news:MP************************@News.Individual.NE T...
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

Jul 17 '05 #11
Chris Hope wrote:
It all depends to what purpose you are trying to determine their
country.
I agree. Gosh, we could say: when you write, you're right!
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.


Sounds reasonable, given that the information is for you
yourself. Consequently, other people cannot come to any
harm or even be inconvenienced.

Abracad, however, said he would like to serve different
pages to different countries. What did he mean? If he
meant a different default selection of a SELECT, as in your
example, fine; but, in my book, serving essentially
different resources, depending on a condition which you
might guess wrongly, is unjustifiable.

Some of the 'you's in my previous article referred to an
unspecified being, not you in particular, Chris. Sorry, I
should have made that clearer.

HAGW! when it comes.

--
Jock
Jul 17 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: josepe | last post by:
Greetings, How i can know the country of the visitor of the web? Thanks a lot.
32
by: Victor | last post by:
I've been to a few websites where it displays the town, state (if USA), country I'm browsing from. Now, I know that detecting country is easy, but how do you determine the town? What ASP...
3
by: bush | last post by:
hi everyone! i want to get the ipaddress,and the country name of a webpage visitor,using asp.Net(C#).if anyone knows about it,plz rply me. thanx in advance.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.