首页 > 如何通过IP取得用户的城市或地区

如何通过IP取得用户的城市或地区

想在项目中实现通过访问者IP得到该IP对应的地区或城市,有什么比较好的办法吗?

之前没有经验,想到的两种可能实现:

麻烦大家分享一下,谢谢


纯真ip库.


纯真ip库;

$ curl ifconfig.me ⇒ 182.242.192.12
$ curl ifconfig.me/ip ⇒ 182.242.192.12
$ curl ifconfig.me/host ⇒
$ curl ifconfig.me/ua ⇒ Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
$ curl ifconfig.me/port ⇒ 56688
$ curl ifconfig.me/lang ⇒ en-US,en;q=0.5
$ curl ifconfig.me/keepalive ⇒
$ curl ifconfig.me/connection ⇒ keep-alive
$ curl ifconfig.me/encoding ⇒ gzip, deflate
$ curl ifconfig.me/mime ⇒ text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
$ curl ifconfig.me/charset ⇒
$ curl ifconfig.me/via ⇒
$ curl ifconfig.me/forwarded ⇒


淘宝的 API: http://ip.taobao.com/instructions.php
或者自己用 GeoIP(如果用量较大): http://php.net/manual/en/book.geoip.php


http://tool.17mon.cn/ipdb.html

【热门文章】
【热门文章】