Associate IP addresses with countries [closed]

痞子三分冷 提交于 2019-12-29 13:30:34

问题


I want to show country flag depending on ip address I receive at server side. Are fixed ip addresses are assigned to countries ? Where can I get database for ip address to country mapping ?


回答1:


Take a look at the following:

  • IP address geolocation SQL database
  • Geo Locate IP Address XML API Whois Map Country Provider
  • How to Geolocate Visitors Using an IP-to-Country Database
  • Free IP to Country Database
  • My IP Address Lookup and Geotarget IP Project
  • MaxMind - Open Source IP Address to Country Database
  • IP address geolocation SQL database

Also on Stack Overflow:

  • What is the most applicable solution to detect which country an ip belongs to?
  • Is there any possible way to find the name of the country using IP with scripting language PHP?
  • IP to Country?
  • code for finding the state,country,city from the IP Adress in php

Once you have the country code, then you can display the flag with these free icon sets which use ISO country codes:

  • Flag icons
  • Flags of the World

PHP Advent also just published a whole article on a very similar process:

  • GeoIP Wrangling



回答2:


You're looking for an IP geolocation service such as MaxMind.




回答3:


ip2location.com provides an IP range database which can be used to tag IP addresses

they provide it in different formats as well so you can choose which one is useful to you




回答4:


Maxmind is the one we use




回答5:


Open Sourced self contained flag rendering based on IP: ip2ensign

It will lookup UV coordinates in a flag texture atlas that matches an arbitrary IP. And it comes with the IP range database and the texture.



来源:https://stackoverflow.com/questions/1935621/associate-ip-addresses-with-countries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!