Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function run() {
- var querystring = require('querystring');
- var https = require('https');
- var data = {'student':{'firstName':'Attila','lastName':'Gal','privateEmail':'attila.gal@gmail.com','schoolEmail':'attila.gal@student.kdg.be','mobilePhoneNumber':'0477246385'},'answers':{'multipleChoice':'Google','tieBreaker':'1500000'}};
- //var jsonData = JSON.parse(data);
- var options = {
- host: 'studentcontest.i8c.be',
- port: '443',
- path: '/gateway/studentContest/1.0/bet',
- method: 'POST',
- headers: {
- 'content-type': 'application/json',
- 'content-length': Buffer.byteLength(JSON.stringify(data)),
- 'Authorization': 'Bearer d4c9532def93417dba3bbe17fd6c58c8'
- }
- };
- var req = https.request(options, function(res) {
- res.setEncoding('utf8');
- res.on('data', function (chunk) {
- console.log("body: " + chunk);
- });
- }).on('error', function(e) {
- console.error(e);
- console.log("***** SCRIPT SHOUD KEEP RUNNING *****");
- });
- req.write(JSON.stringify(data));
- req.end();
- }
- setInterval(run, 3500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement