0

The question is just how should I write my code to receive just one cookie, which I could use for connecting to websites that require logging in?

Connection.Response res = Jsoup.connect("https://gmail.com")
        .data(<all stuff for logging in>)
        .execute();

And res.cookies() would give me my session ID etc.

Mahendra Gunawardena
  • 1,956
  • 5
  • 26
  • 45
Bartosz Woźniak
  • 2,065
  • 3
  • 14
  • 31

1 Answers1

0

I tried this:

  String loginUrl = "https://accounts.google.com/Login?hl=pl#identifier";
  Connection.Response res = Jsoup.connect(loginUrl)
          .data("Email", MYMAIL)
          .execute();

  Connection.Response res2 = Jsoup.connect(loginUrl)
          .cookies(res.cookies())
          .data("Passwd", MYPASS)
          .execute();


  Document page = Jsoup
            .connect("https://adwords.google.com/")
            .cookies(res2.cookies()) 
            .get();

  System.out.println(page.toString());

And I don't see the page I want to see. Propably this shouldn't be working but I can't code anything better yet. It worked on t

Basically, my main target is to be able to extract data from AdWords using Java (I'm working with Eclipse). The last obstacle is logging in.

Bartosz Woźniak
  • 2,065
  • 3
  • 14
  • 31