var http = require(“http”); var querystring = require(“querystring”);
var options = { hostname: '127.0.0.1’, port: 9000, path: '/modules/login/checkSign.php’, method: ‘POST’ }; var contents = querystring.stringify({ username: 'admin’, password: ‘123456’ }); var req = http.request(options, function(res) { res.setEncoding(‘utf8’); res.on('data’, function (data) { console.log(‘BODY:’ + data); }); });
req.on('error’, function(e) { console.log('problem with request: ' + e.message); });
req.write(contents); req.end(); 接收不到这里提交的参数呢?请各路大神指教一下!