PGM_DEV PGM_DEV - 1 month ago 16
Node.js Question

Login with Node.js

I want to do a POST action with node.js with a command line application.
The goal is to login to http://hbeta.net
(I want to create a application that post the username and the password automaticly)
thanks ;)

Answer

If the website supports posting data to the login and receiving a login cookie/token back, you can use the following code:

var cloudscraper = require('cloudscraper');

cloudscraper.post('http://hbeta.net/', {
    username: 'username',
    password: 'password'
}, function(error, response, body) {
    if (error) {
        console.log("an error has occured");
    } else {
        console.log(body, response);
    }
});

This code will simply send a POST method to http://hbeta.net/ while bypassing their CloudFlare DDOS protection and send a username and password along with the request.