Get the region corresponding to the IP through the IP address query developed by Taobao.
This is not original, just a repost; Taobao’s IP address database should be considered authoritative, and Taobao provides a very convenient interface, so you don’t have to worry about obtaining IP information.
- 1. Request interface (GET):
- http://ip.taobao.com/service/getIpInfo.php?ip=[ip address string]
-
- 2. Response information:
-
- (json format ) country, province (autonomous region or municipality), city (county), operator
-
- 3. Return data format:
- {"code":0,"data":{"ip":"210.75.225.254","country ":"u4e2du56fd","area":"u534eu5317",
- "region":"u5317u4eacu5e02","city":"u5317u4eacu5e02","county":"","isp":"u7535u4fe1",
- "country_id" :"86","area_id":"100000","region_id":"110000","city_id":"110000",
- "county_id":"-1","isp_id":"100017"}}
- where The meaning of the value of code is, 0: success, 1: failure.
Copy code
|