java - Logging in and redirecting into a website using jsoup -
iam presently using jsoup library parsing websites.can use jsoup.connect(url).get() using login info. user id , password or else other library provide function.i have seen solutions using login page parsing of website.but there way directly connect using user name , pwd.thanks help.
short answer: depends.
you have understand how user authenticates on site parsing. may username , password sent get/post request parameter (if login form used, see "form-based authentication") or site uses web container authentification, configured in web.xml (basic, ntlm, kerberos etc.).
in case of form-based authentication accepting post requests can use
jsoup.connect(url).data("user","username","pwd","1234").post();
if login form has input named user
username , pwd
password. aware send password unencrypted on network (unless use https).
for other authentifications consider using full-sized http client (e.g. apache httpclient) , rtfm (see credentials provider, user credentials).
you 1 of jsoup.parse(...)
methods parse responses using http client of choice.
Comments
Post a Comment