如何确定网站访问者的原籍国?

时间:2009-12-31 11:32:30

标签: php

如何确定网络访问者的原籍国?

2 个答案:

答案 0 :(得分:4)

查看PHP的ip2country类。

答案 1 :(得分:1)

如果您需要更好的可靠性并且可以提供不完全免费的解决方案,我会向您推荐

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>