3

I use PHP and I want to know if there's a free web service that can detect the countries of my visitors. Right now i can get their IPs and I have downloaded some IPtables that relate some locations but i don.t think they're quite accurate. So if you are aware of some free webservice it would be just great. Thanks!

1
  • 3
    No IP-to-location will ever be quite accurate; I wouldn't trust the accuracy beyond "identify the country". Many operators are NATing their mobile clients, Opera (both desktop and mobile) has a proxy+accelerator in Norway, corporate users have VPNs which make the connections appear to be from the main office, and the geolocation data is often faulty (e.g. most IP geolocators pinned me some 200 km off, on a DSL - the company running it was based elsewhere than I was located). Obligatory XKCD: xkcd.com/713 Aug 30, 2010 at 9:40

3 Answers 3

3

I have used the following SOAP GeoIPService to good effect from webservicex.net.

You will also of course need to enable SOAP support in your PHP config.

You could then try something like:

$client = new SoapClient("http://www.webservicex.net/geoipservice.asmx?WSDL");
$params = new stdClass;
$params->IPAddress = 'xxx.xxx.xxx.xxx';
$result = $client->GetGeoIP($params);
// Check for errors...
$country = $result->GetGeoIPResult->CountryName;
2
  • it looks niche, i'll try it at home and if everything's OK i'll check this one as the best answer :) Aug 30, 2010 at 11:10
  • You could also try ipinfodb.com/ip_location_api.php which is another good free one if the above doesn't work out for you. I would take the results with a grain of salt though as it is free so you can't expect them to be 100% accurate.
    – hydrogen
    Aug 30, 2010 at 21:30
2

You could look around at MaxMind's open source solutions.

2
  • i tried the GeoIP Country link... but it says that i have to pay a 50$USD license fee :( Aug 30, 2010 at 11:11
  • You'll need to use GeoLite libraries at the Open Source section.
    – fabrik
    Aug 30, 2010 at 12:04
0

You could download and use this database http://software77.net/geo-ip/

1
  • cool, but i was actually looking for a web service, thanks anyways Aug 30, 2010 at 11:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.