0

I've looked everywhere and hit a dead end. I cant seem to login using jsoup even though everything looking right. I tried using Document instead of Connection.Response for the second connection but still failed. And I'm pretty sure this all the data needed to login. Any help appreciated.

public class Test {



public static void main(String[] args) {

    try {
        Connection.Response initial = Jsoup.connect("https://mytedata.net/wps/portal/ssp/WSLogin/")
                .method(Connection.Method.GET)
                .execute();

        Connection.Response login = Jsoup.connect("https://mytedata.net/wps/portal/ssp/WSLogin/")
                .data("javax.faces.encodedURL", "%2Fwps%2Fportal%2Fssp%2FWSLogin%2F%21ut%2Fp%2Fa1%2F04_Sj9CPykssy0xPLMnMz0vMAfGjzOKd3R09TMx9DAwMTCyMDDxdnDxczC19DQx8TYEKIoEKDHAARwNC-sP1o8BKPANMDDwsLAy83P3dLQw8zcMMnPwcDQwNTAygCvBYUZAbYZDpqKgIAHDzbiY%21%2Fdl5%2Fd5%2FL2dBISEvZ0FBIS9nQSEh%2Fpw%2FZ7_49L81I02J0VS50AFQUGD3C00G4%2Fres%2Fid%3DLoginPortletView.xhtml%2Fc%3DcacheLevelPage%2F%3D%2F")
                .data("javax.faces.ViewState", "QFGkXvcilKfcbPXW1qJENp5sG6jAAt89s5%2BIY9vyKom3S72E9rizdFrPeA%2FYjD3Ja1sMNvMQtrSOkF2TUnKrEGYnxx918q5QVq2XkGqCVqm3iMQ1JFMuqBOe%2FJhaiOIueXg6Fw%3D%3D")
                .data("viewns_Z7_49L81I02J0VS50AFQUGD3C00G4_%3Aform1%3AcommandButtonSignIn", "Log+In")
                .data("viewns_Z7_49L81I02J0VS50AFQUGD3C00G4_%3Aform1%3AinputSecretPassword", "mypassword")
                .data("viewns_Z7_49L81I02J0VS50AFQUGD3C00G4_%3Aform1%3AinputTextEmail", "myemail")
                .data("viewns_Z7_49L81I02J0VS50AFQUGD3C00G4_%3Aform1_SUBMIT", "1")
                .cookies(initial.cookies())
                .method(Connection.Method.POST)
                .execute();

        Document doc = Jsoup.connect("https://mytedata.net/wps/myportal/ssp/Home")
                .cookies(login.cookies())
                .get();

        Elements ele = doc.select("span.grayItem");
        System.out.println(ele.text());



    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

} }

Dr BigKitkat
  • 283
  • 1
  • 5
  • 13

0 Answers0