1
回答
nodejs怎么模拟登陆?
百度AI开发者大赛带你边学边开发,赢100万奖金,加群:418589053   
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();

用PHP模拟了参数接收,不能获取并输出参数,是怎么回事呢?

举报
unofficial
发帖于4年前 1回/346阅
顶部