On this website, you can enter your student-card-number, and then it will display how much money is left on that card. I want to obtain the information using JSOUP. This is my current code, but it does not work,
String url = "http://kortladdning3.chalmerskonferens.se/CardLoad_Order.aspx";
Connection.Response loginForm = Jsoup.connect(url)
.method(Connection.Method.GET)
.execute();
Document document = Jsoup.connect(url)
.userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36")
//.data("__VIEWSTATE","%2FwEPDwUHNjA4NDA1NQ9kFgQCAw9kFgoCAQ9kFgICAQ8PFgIeBFRleHQFClBUTSBLb3J0bnJkZAICDxYCHgdWaXNpYmxlaGQCAw8WAh8BaGQCBA8WAh8BaGQCBQ8WAh8BaBYCAgEPEGRkFgBkAgUPDxYCHwAFCShkZXNrdG9wKWRkZGzBhwMIv3yxqKnC0C7%2BPlC0PlDG")
.data("__EVENTVALIDATION", "%2FwEWBAKG7bXPBQLi0uqnCgKF69rWBAK14fOOCgrUt4CBVP4K0VKe0uOPxLSAu26y")
.data("hiddenIsMobile", "desktop")
.data("txtCardNumber", "3819276248xxxxxx")
.data("SavedCardNumber", "")
.data("btnNext","N%C3%A4sta")
.cookies(loginForm.cookies())
.get();
System.out.println(document.html());
I dont have much experience so I dont know where to look for the problem. Some thoughts:
- Should I use
.post()or.get()? - When looking in chrome devoloper tools, the post data is all the data I send with
.data(.., ..)function. However if a send__VIEWSTATEI get an error, why? - Should I send decrypted or crypted data? (both are presented in chrome devoloper tools).
- Am using the correct URL?