java - Cannot login to website using jsoup -


i trying login this website.
here have tried far, doesn't seem work:

try{        connection.response login = jsoup.connect("login_url").method(connection.method.get).execute(        connection.response doc = jsoup.connect("https://ecampus.psgtech.ac.in/studzone/")               .data("txtstudid","id")               .data("txtpasswd","password")               .data("btnlogin","login")               .useragent("mozilla/5.0 (windows nt 6.1; wow64; rv:50.0) gecko/20100101 firefox/50.0")               .method(connection.method.post).execute(); //doesn't seem work.        document docs=jsoup.connect("https://ecampus.psgtech.ac.in/studzone/attwfpercview.aspx/") //after login                                 .cookies(doc.cookies())                                 .useragent("mozilla/5.0 (windows nt 6.1; wow64; rv:50.0) gecko/20100101 firefox/50.0").get();        test=docs.title();    }catch (ioexception e){        test=e.getmessage();    }    out.settext(docs.title()); 

what doing wrong?

edit 1 of tdg found flaw.

for users seeking solution this, actual issue not passing enough data login.

step 1: go chrome load page then, options>tools>developer tools

step 2: in console type $("input") return inputs required in form step 3: append data response this.

jsoup.connect("login_url")               .data("username","user")               .data("password","password")               .data("btnlogin","login")               .data("id_of_the_data_required","value")               .data("...and on this...)               .useragent("mozilla/5.0 (windows nt 6.1; wow64; rv:50.0) gecko/20100101 firefox/50.0")               .method(connection.method.post).execute();  

step 4: crawl webpage's html code , find whether have use post or get method , recommend use useragent.

step 5: once find login event successful. use response_name. cookies() go other urls in page.

hope helps.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -