computers computers - 3 months ago 22
Node.js Question

NodeJS request.post method issue


Resolved: It seems that Mumbai university uses different servers for
different results, which i did notice.


I am writing a script to retrieve my results directly from my university website. But I am facing problems with the "request.post" method in "request" module of NodeJS.

Here's my code

var cheerio = require('cheerio');
var request = require('request');
request.post({
headers: {'content-type' : 'application/x-www-form-urlencoded', 'content-length':69},
url: 'http://results.mu.ac.in/get_resultc.php',
body: "exam_id=4050&exam_year=2016&exam_month=MAY&seat_no=45280208&submit=Go"
}, function(error, response, body){
var $ = cheerio.load(body);
console.log($('html').text());
var result = $('b').text();
console.log(result);
});


I get the following output

..
..
No Such Seat No!!


But if i send the same post data with Burp I get the correct output as shown in the image below.

Link to image

Please let me know where I have gone wrong and what can be done. Thank You.


NOTE: The shown query is a test query and is not related to my exam id
or seat number.

Answer

The URL in your code above point to:

url:     'http://results.mu.ac.in/get_resultc.php',

But the image points to:

url:     'http://results.mu.ac.in/get_resultb.php',

"get_resultb.php"

Posting to get_resultb.php yeilds:

Results for B.E.Degree (COMPUTER ENGG.) (SEM-VIII) (CBSGS) held on MAY 2016

The result of seat number 45280208 is PassedCongratulations.
Comments