How do u tell what country a client is browsing from ?
Moderator: General Moderators
How do u tell what country a client is browsing from ?
Anyone know how to tell what country a client is from ?
If I use "gethostbyname" I can get the users IP address.
Any idea how to find what country this is, either from that function or any other ?
Cheers
If I use "gethostbyname" I can get the users IP address.
Any idea how to find what country this is, either from that function or any other ?
Cheers
Demo: http://perfectphp.com/ipatlas/plot.php
Source: http://www.xpenguin.com/ip-atlas.php
Download: http://www.xpenguin.com/ip-atlas-1.0.zip
You can either put in a domain (http://www.aol.com) or it's ip (64.12.187.24) [any ip for that matter]
Source: http://www.xpenguin.com/ip-atlas.php
Download: http://www.xpenguin.com/ip-atlas-1.0.zip
You can either put in a domain (http://www.aol.com) or it's ip (64.12.187.24) [any ip for that matter]
OMG ! That was by far the worst code I've ever seen in my life !!
Here's some snippets from there :
I couldn't read that <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>
Anyone have any other ideas how to look up a country from an IP ?
Cheers
Here's some snippets from there :
Code: Select all
function stuffanalyze($stuff) {
for ($count = 0; $count < count($stuff2); $count++) {
$stuff2[$count] = $stuff2[$count][0];
$stuff2[$count] = ucwords(strtolower(trim(substr(substr($stuff2[$count], 15), 0, -5))));
}
}
function getstuff($address, $local) {
.....
}Anyone have any other ideas how to look up a country from an IP ?
Cheers
Could you use the value in the $_SERVER["HTTP_ACCEPT_LANGUAGE"] variable? This often has the country abbreviation in the value. Of course, this is entirely user-configurable (which means the user can set it to whatever they want) and is meant to identify the language and not necessarily the country.
Check this class here:
http://www.phpclasses.org/browse.html/package/693.html
It's not working perfectly, but it's a very nice example.
http://www.phpclasses.org/browse.html/package/693.html
It's not working perfectly, but it's a very nice example.
http://www.xpenguin.com/ip-atlas.php wrote: IP-Atlas 1.0 (Released July 3rd)
IP-Atlas tries to plot your location or any other host on the internet using the NetGeo data. It finds the latitude and longitude coordinates of the host and plots it on an image for you. You can try the demo and/or download it (91k). IP-Atlas requires PHP and optionally the GD library.
