这是一个简单的我猜: 我想请求一个Node.js
服务器,因为我目前正在使用cURL。无论我尝试什么,我都会从服务器收到错误404。使用请求转换节点js的cURL请求
这里是我的合法卷曲命令,它会返回一个JavaScript对象:
curl --data "ajax=1&example=test" http://some-site-example.com
阅读卷曲说明书及申请手册后,这里是我在Node.js
尝试:
request.post({'content-type':'application/x-www-form-urlencoded',ajax:'1',example:'test',url:'http://some-site-example.com'}, function(err, result, body) {
if (err) console.log(err);
else console.log(body);
});
是[要求](HTTPS: //www.npmjs.org/package/request)模块? – Ravi 2014-10-10 12:19:28