Last active
August 30, 2017 16:00
-
-
Save zszszsz/352417e0db63b5c715b61ae8663b0d22 to your computer and use it in GitHub Desktop.
njit intl hold test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const options = { | |
hostname: 'myhub.njit.edu', | |
path: '/StudentRegistrationSsb/ssb/term/search?mode=registration', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded', | |
'Content-Length': 69, | |
'X-Requested-With': 'XMLHttpRequest', | |
Cookie: 'your cookies here', //your cookies here | |
'X-Synchronizer-Token': 'your sync token here', // your sync token here | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0', | |
Referer: 'https://myhub.njit.edu/StudentRegistrationSsb/ssb/term/termSelection?mode=registration' | |
} | |
} | |
var timeout = 10000; | |
var count = 0; | |
function send() { | |
var buffer = ''; | |
var req = https.request(options, res => { | |
res.on('data', chunk => buffer += chunk); | |
res.on('end', () => { | |
buffer = JSON.parse(buffer); | |
console.log(count + '\n***************\n' + buffer["studentEligFailures"][0] + '\n*************\n'); | |
count += 1; | |
if (buffer["studentEligValid"]) { | |
console.log('true'); | |
process.exit(0); | |
} | |
if(!buffer["studentEligFailures"]) { | |
console.log('renew your cookie'); | |
process.exit(0); | |
} | |
setTimeout(send, timeout); | |
}); | |
}); | |
req.write('term=201790&studyPath=&studyPathText=&startDatepicker=&endDatepicker='); | |
req.end(); | |
} | |
send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment