通过php中的ip地址获取城市


Get the city by ip adrresse in php

我在php中通过ip地址获取城市时遇到了一个biig问题,代码在yerstedy工作,但现在我得到了一个错误:超过限制,我的代码:

 public function getCityAndCountryByIp($ip){
    //get the city
    $tags = get_meta_tags('http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress='.$ip);
    $result = $tags['city'];
    return $result;

请帮帮我,代码工作得更早,有任何建议请

错误Limit exceed应该很清楚,您使用了给定时间段内的所有空闲请求。您应该为更多请求购买许可证,或者使用免费服务。

使用php-goip扩展,它有一个免费的商业版本http://php.net/manual/en/book.geoip.php