开发者

is there a web service that can detect the country of a visitor in PHP? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered开发者_如何学编程 with facts and citations.

Closed 7 years ago.

Improve this question

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!


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;


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜