Guys, please explain what am I doing wrong?

Express server. I send request cURL'om, php normally processes.

Request such:

$ch = curl_init(); $arr = ['email' => $email, 'password' => $password]; curl_setopt($ch, CURLOPT_URL,"http://site/send"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $arr); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); curl_close ($ch); 

I process everything on the node.js server, data does not come.

Handler:

 var express = require("express"), bodyParser = require("body-parser"); var urlencodedParser = bodyParser.urlencoded({extended: false}); var app = express(); app.post("/send", urlencodedParser, function (req, res) { var email = req.body.email, password = req.body.password; console.log(email, password); }); app.listen(80); 

What's wrong? Why data is not processed?

console.log(res.body) also displays nothing at all.

  • where do you console.log(res.body) ? - Tvolex

0