A simple POST request with authentication data is demonstrated below, note that the username
and password
field will vary depending on the website:
final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36";
Connection.Response loginResponse = Jsoup.connect("yourWebsite.com/loginUrl")
.userAgent(USER_AGENT)
.data("username", "yourUsername")
.data("password", "yourPassword")
.method(Method.POST)
.execute();