代码片段
// npm i --save-dev request
const request = require('request');
const url = "http://ip.taobao.com/service/getIpInfo2.php"; // 淘宝接口
request.post({
url: url,
form: {
ip: 'myip'
}
}, (err, httpResponse, body) => {
const data = JSON.parse(body);
console.log(data.data.ip);
})