Identifying country by IP address

前端 未结 13 998
盖世英雄少女心
盖世英雄少女心 2020-12-01 05:24

Is there a way to figure out the country name just by looking at an IP address? I mean, do countries have specific ranges of IP addresses? For example, Australia can have IP

13条回答
  •  眼角桃花
    2020-12-01 05:41

    You can try using https://ip-api.io - geo location api that returns country among other IP information.

    For example with Node.js

    const request = require('request-promise')
    
    request('http://ip-api.io/api/json/1.2.3.4')
      .then(response => console.log(JSON.parse(response)))
      .catch(err => console.log(err))
    

提交回复
热议问题