Home >Backend Development >PHP Tutorial >Obtain IP location through Taobao IP address database

Obtain IP location through Taobao IP address database

WBOY
WBOYOriginal
2016-07-25 09:07:091206browse
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. 1. Request interface (GET):
  2. http://ip.taobao.com/service/getIpInfo.php?ip=[ip address string]
  3. 2. Response information:
  4. (json format ) country, province (autonomous region or municipality), city (county), operator
  5. 3. Return data format:
  6. {"code":0,"data":{"ip":"210.75.225.254","country ":"u4e2du56fd","area":"u534eu5317",
  7. "region":"u5317u4eacu5e02","city":"u5317u4eacu5e02","county":"","isp":"u7535u4fe1",
  8. "country_id" :"86","area_id":"100000","region_id":"110000","city_id":"110000",
  9. "county_id":"-1","isp_id":"100017"}}
  10. where The meaning of the value of code is, 0: success, 1: failure.
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn