使用node.js,您可以只使用http.request方法
http://nodejs.org/docs/v0.4.7/api/all.html#http.request
此方法内置在节点中,您只需要http。
如果您只想执行GET,则可以使用http.get
http://nodejs.org/docs/v0.4.7/api/all.html#http.get
var options = { host: 'www.google.com', port: 80, path: '/index.html'};http.get(options, function(res) { console.log("Got response: " + res.statusCode);}).on('error', function(e) { console.log("Got error: " + e.message);});
(来自node.js文档的示例)
您还可以使用mikeal的请求模块
https://github.com/mikeal/request
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)