Friday, 9 June 2017

node.js module request i cant login in extern website why :x

i trying to make a login to get some user values, the code seems right but dont work, can anybody help???

var request = require('request');
var url='http://tremorgames.com';

var user='hidden';
var pw='hidden';

var jar = request.jar();

var request = request.defaults({
  jar: jar,
  followAllRedirects: true
});
var jar = request.jar();

request.post({
    url: 'http://www.tremorgames.com/index.php',
    headers: { 
    'content-type': 'application/x-www-form-urlencoded', 
    'Connection':'keep-alive', 
    'Cache-Control':'max-age=0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Referer': 'http://www.tremorgames.com/login.html',
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
 },
    method: 'post',
    jar: jar,
    body: 'loginuser='+user+'&loginpassword='+pw+'&saveme=1&redirect='
}, function(err, res, body){
  if(err) {
    return console.error(err);
  };

//do some stuff aff success

});  

i have made some console.logs() to try to find out what is going on, and the only cookie the request are saving are some PHPSESSID, i have already asked google but i dont find anything relevant or anything i can get it :/



via Diego Ferreira

No comments:

Post a Comment