Skip to content

Instantly share code, notes, and snippets.

@rainb3rry
Last active October 9, 2018 04:15
Show Gist options
  • Save rainb3rry/e5680b2fef5f914da86060f6feeebe6c to your computer and use it in GitHub Desktop.
Save rainb3rry/e5680b2fef5f914da86060f6feeebe6c to your computer and use it in GitHub Desktop.
try registration with post request but site has a token control
const request = require('request');
const cheerio = require('cheerio');
let register = 'https://www.n11.com/uye-ol'
request(register, function (error, response, body) {
const $ = cheerio.load(body);
let token = $('.birthDate').next().next().next().next().val();
console.log(token);
request.post(
{
url: register,
form: {
firstName: 'ahmet',
lastName: 'yilmaz',
email: '[email protected]',
password: 'nabersin1',
passwordAgain: 'nabersin1',
gender: 'M',
birthDay: 0,
birthMonth: 0,
birthYear: 0,
acceptContract: 'on',
token: token
}
},
function(err, httpResponse, body) {
console.log(body);
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment