var options = { host: 'localhost’, port: 80, path: '/backbone/data.php’, method: ‘POST’ };
var req = http.request(options, function(res) { console.log('STATUS: ' + res.statusCode); console.log('HEADERS: ' + JSON.stringify(res.headers)); res.setEncoding(‘utf8’); res.on('data’, function (chunk) { console.log('BODY: ' + chunk); }); }); // write data to request body req.write(‘name=liuzhang&age=29’);
为什么用$_POST是空的,我已经res.write