Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- So, lets suppose you are trying to login into www.addic7ed.com. These are the
- headers that were captured by the Live Http Header addon
- -------------------------------------------------------------------------------------------------------------------
- [I am just mentioning the relevant ones]
- -------------------------------------------------------------------------------------------------------------------
- 1)POST /dologin.php HTTP/1.1
- 2)User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
- 3)Referer: http://www.addic7ed.com/login.php
- 4)Cookie: PHPSESSID=ff39a25af0d71e6535d946b454dd94
- 5)username=ranveer5289&password=mypasswordissecret&Submit=Log+in
- So, if you take a look the 5th header is the important one.
- Therefore first try to send this header using
- Document doc = Jsoup.connect("http://www.addic7ed.com/login.php").data("username", "ranveer5289",
- "password", "mypasswordissecret","Submit","Log+in").post();
- If than also you are not able to login than your site need cookies in the request
- to be send by your Java code.
- Document doc = Jsoup.connect("http://www.addic7ed.com/login.php").data("username", "ranveer5289",
- "password","mypasswordissecret","Submit","Log+in").cookie("PHPSESSID","ff39a25af0d71e6535d946b454dd94").post();
- for some website you may also need to set Referer and User-Agent.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement