当前位置:如说吧 > 其它 > 正文

node request请求接口

2020-07-01 5

get的参数url,直接写到url里面就行了啊。

var request=require(request);
request.get(http://ip.taobao.com/service/getIpInfo.php?ip=8.8.8.8,function(err,response,body){
console.log(body)
})
F:adminnodejs>node test.js
{"code":0,"data":{"country":"u7f8eu56fd","country_id":"US","area":"","area_id"
:"","region":"","region_id":"","city":"","city_id":"","county":"","county_id":""
,"isp":"","isp_id":"","ip":"8.8.8.8"}}
本周热门
热门文章
热门关注