I created an application that parses content of secured areas of one webpage after account information input. It used GET method for loging in, so it was quite simple, I just used URL to log in. Now it was changed to POST method and I wonder how to log in to that site? The login form uses 2 input tags of type text with names 'login' and 'pass'.
views:
28answers:
2
Q:
How to login to a webpage and get its html code with Java, when it uses post method for logging in ?
+2
A:
Have you tried setting the request method?
HttpURLConnection conn = new HttpURLConnection(url);
conn.setRequestMethod("POST");
OutputStream os = conn.getOutputStream();
os.write(...);
Object content = conn.getContent();
David Grant
2010-03-03 11:38:53
+2
A:
Are you using something like apache commons http. You can use post method.
saugata
2010-03-03 11:40:28