Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Connect {
- public static void main(String[] args) {
- String pageURL = "https://parents.mtsd.k12.nj.us/genesis/parents?tab1=studentdata&action=form";
- String param1 = "&tab2=gradebook";
- String param2 = "&tab3=weeklysummary";
- String param3 = "&studentid=";
- Scanner input = new Scanner (System.in);
- String initURL = "https://parents.mtsd.k12.nj.us/genesis/parents?gohome=true";
- String sID = "not shown";
- String URLF = pageURL + param1 + param2 + param3 + sID;
- connectTo(URLF);
- }
- public static Document connectTo (String URLF){
- String loginURL = "https://parents.mtsd.k12.nj.us/genesis/parents/j_security_check";
- String userDataUrl = URLF;
- String username = "not shown";
- String password = "not shown";
- Connection.Response res = null;
- Document doc = null;
- try {
- res = Jsoup.connect(userDataUrl)
- .userAgent("Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.4 Safari/537.36")
- .header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
- .timeout(500)
- .method(Connection.Method.GET)
- .execute();
- } catch (IOException io) {io.printStackTrace();}
- try {
- doc = Jsoup.connect(loginURL)
- .userAgent("Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.4 Safari/537.36")
- .referrer("https://parents.mtsd.k12.nj.us/genesis/parents?gohome=true")
- .cookies(res.cookies())
- .data("j_username", username)
- .data("j_password", password)
- .post();
- } catch (IOException ioe) {ioe.printStackTrace();}
- if (doc != null){
- System.out.print(doc.text());
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement