Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question 开发者_如何学编程How to determine a web visitor's country of origin?
Take a look at the ip2country class for PHP.
If you need a better reliability and can offer not totally free solution I would recommend to you
http://worldtimeengine.com/api/ip
Here's an example for the IP address 195.110.64.205:
http://worldtimeengine.com/api/ip/9d89405104e16732fa00caa1e8e6cdfd/195.110.64.205 which will return the following XML response:
<?xml version="1.0" encoding="UTF-8" ?>
<timezone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://worldtimeengine.com/timezone.xsd">
<version>1.1</version>
<location>
<region>United Kingdom</region>
<latitude>51.5</latitude>
<longitude>-0.1167</longitude>
</location>
<time>
<utc>2008-07-11 13:30:38</utc>
<local>2008-07-11 14:30:38</local>
<zone>
<hasDST>true</hasDST>
<current>
<abbreviation>BST</abbreviation>
<description>British Summer Time</description>
<utcoffset>+1:00</utcoffset>
<isdst>true</isdst>
<effectiveUntil>2008-10-26 00:00:00</effectiveUntil>
</current>
<next>
<abbreviation>GMT</abbreviation>
<description>Greenwich Mean Time</description>
<utcoffset>+0:00</utcoffset>
<isdst>false</isdst>
<effectiveUntil>2009-03-29 01:00:00</effectiveUntil>
</next>
</zone>
</time>
</timezone>
精彩评论