How can I view visitors country using php/apache?
Country
Collapse
This topic is closed.
X
X
-
T0MATags: None -
dr. zoidberg
Re: Country
T0MA wrote:
[color=blue]
> How can I view visitors country using php/apache?[/color]
You can't. All you can do is get visitors IP adress and then with that
address get visitors country.
-
SeeSchloss
Re: Country
> How can I view visitors country using php/apache?
Well, what you can do is find the ip address
($_SERVER['REMOTE_ADDR'] or $_SERVER['HTTP_CLIENT_IP ']),
find the domain (with gethostbyaddr ($ip)) and then find
the tld (substr ($domain, strpos ($domain, '.') + 1)). You
will get the country of his provider (unless he connects
with AOL : always .com).
You can also use the language
($_SERVER['HTTP_ACCEPT_LA NGUAGE']) and guess the country
he's from with that but it is not very accurate.
--
SeeSchloß - http://www.seeschloss.net
Comment
-
John Dunlop
Re: Country
dr. zoidberg wrote:
[color=blue]
> T0MA wrote:
>[color=green]
> > How can I view visitors country using php/apache?[/color][/color]
I'm interested in why you want this information? Mere idle
curiosity?
[color=blue]
> You can't. All you can do is get visitors IP adress and then with that
> address get visitors country.[/color]
And even that's unreliable.
Let's be optimistic and pretend that your IP address maps to a
country-specific domain, .hr perhaps, and not .com, .net, etc.
Because if it were a domain of .com or suchlike, we'd all know
straight off that it's pure guesswork.
However, the country-specific domain of .hr, for example,
categorically does not imply that you're sitting in Croatia at
that precise moment in time. You may have connected to a machine
in Croatia whilst you were lazing around in neighbouring Slovenia
(domain .si) or wherever, and accessed a document via that route.
--
Jock
Comment
-
Allan Savolainen
Re: Country
On Sun, 28 Sep 2003 18:27:59 +0200, "dr. zoidberg"
<someone@exampl e.wrong> wrote:
[color=blue]
>T0MA wrote:
>[color=green]
>> How can I view visitors country using php/apache?[/color]
>
>You can't. All you can do is get visitors IP adress and then with that
>address get visitors country.
>[/color]
Exactly, and you can get a IP to country database from:
there even seems to be a PHP4 example.
- allan savolainen
Comment
-
Randell D.
Re: Country
"T0MA" <tomaOVOIZBACIK ADMISALJESMAIL@ us.zzn.com> wrote in message
news:bl6skd$tdl $1@bagan.srce.h r...[color=blue]
> How can I view visitors country using php/apache?
>
>[/color]
Try compile Apache/PHP with GeoIP from www.maxmind.com - It does not rely on
the domain name (thus it does not need to resolve the users IP address in to
a domain) - In addition, performance benifits can be enhanced if you switch
off Apaches hostnamelookup switch. I use Apache/PHP with GeoIP and
Webalizer to get excellent logging. The GeoIP country edition is free, but
the city/region specific database is avaiable for a small yearly fee.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
Comment
-
Andy Jeffries
Re: Country
On Sun, 28 Sep 2003 21:32:24 +0100, John Dunlop wrote:[color=blue][color=green]
>> You can't. All you can do is get visitors IP adress and then with that
>> address get visitors country.[/color]
>
> And even that's unreliable.
>
> Let's be optimistic and pretend that your IP address maps to a
> country-specific domain, .hr perhaps, and not .com, .net, etc.
> Because if it were a domain of .com or suchlike, we'd all know
> straight off that it's pure guesswork.
>
> However, the country-specific domain of .hr, for example,
> categorically does not imply that you're sitting in Croatia at
> that precise moment in time. You may have connected to a machine
> in Croatia whilst you were lazing around in neighbouring Slovenia
> (domain .si) or wherever, and accessed a document via that route.[/color]
No, but as a lot of other posts point out the information to convert an IP
to a country is available, so you could tell from their current IP address
where they are connected from.
I've used ip2nation.com before (but apparently their services are on hold
at the moment).
Cheers,
Andy
Comment
-
Manuel Lemos
Re: Country
Hello,
On 09/28/2003 11:51 AM, T0MA wrote:[color=blue]
> How can I view visitors country using php/apache?[/color]
This class does exactly what you ask:
--
Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
Free PHP Classes and Objects 2025 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials
Comment
-
MK Wong
Re: Country
Try http://www.ip2location.com
"Randell D." <you.can.email. me.at.randelld@ yahoo.com> wrote in message news:<7OLdb.386 76$I36.12729@pd 7tw3no>...[color=blue]
> "T0MA" <tomaOVOIZBACIK ADMISALJESMAIL@ us.zzn.com> wrote in message
> news:bl6skd$tdl $1@bagan.srce.h r...[color=green]
> > How can I view visitors country using php/apache?
> >
> >[/color]
>
> Try compile Apache/PHP with GeoIP from www.maxmind.com - It does not rely on
> the domain name (thus it does not need to resolve the users IP address in to
> a domain) - In addition, performance benifits can be enhanced if you switch
> off Apaches hostnamelookup switch. I use Apache/PHP with GeoIP and
> Webalizer to get excellent logging. The GeoIP country edition is free, but
> the city/region specific database is avaiable for a small yearly fee.[/color]
Comment
Comment