您的位置:首页 > 其它

利用命令行工具curl获取公网ip地址

2014-11-20 15:33 429 查看
一个是:

curl  ifconfig.me


另一个是:

curl  ipinfo.io


这个输出的信息很丰富,如城市,地区,国家,经纬度等都能显示,如下面:

{
"ip": "223.68.142.242",
"hostname": "No Hostname",
"city": null,
"region": null,
"country": "CN",
"loc": "35.0000,105.0000",
"org": "AS56046 China Mobile communications corporation"
}


另外如果查询的时候在ipinfo.io后加上特定ip地址,输出的是这个ip的信息,eg:

curl  ipinfo.io/202.65.246.80


则输出:

{
"ip": "202.65.246.80",
"hostname": "No Hostname",
"city": "Singapore",
"region": "00",
"country": "SG",
"loc": "1.2931,103.8558",
"org": "AS4773 MobileOne Ltd. Mobile/Internet Service Provider Singapore"
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: