JSFiddle - React, Tailwind, and code Playground
JavaScript
var https = require('https');
var excel = require('exceljs');
var fs = require('fs');
var querystring = require('querystring');
const post_data = querystring.stringify({
'username': 'user',
'password': 'passwd'
});
const auth_opt = {
hostname: 'mysite.ru',
port: 443,
path: '/logon',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Content-Length': Buffer.byteLength(post_data)
}
};
const logon = https.request(auth_opt, (res) => {
res.on('data', (d) => {
console.log('There is a message: ' + d);
});
});
logon.on('error', (e) => {
console.log('Something went wrong with logon: ' + e);
});
logon.write(post_data);
logon.end();