Amit said:
What I am trying to do is to retrieve and save a page from a website.
The website has a login page which is a form. When I type the url for
any page, it returns the login page. i want to send the username and
password using my Java program, so that it will return the actual
page, rather than the redirected login page. Is it possible to submit
the login form and then access the required page.
Okay, you need to first examine the login page, and find out some things
about it:
1. What is the name of the form field used for the username?
2. What is the name of the form field used for the password?
3. What is the URL used to submit the form (the "action")?
4. What HTTP "method" is used to submit the form?
5. Are there any extra form parameters expected by the server?
Once you know this, you can build an appropriate HTTP request to
simulate the form submission. Once you've submitted the form, chances
are you need to handle cookies to actually remain logged in to the
server. For *all* of this stuff (from building form parameters into an
HTTP request to maintaining state with cookies), Jakarta Commons
HttpClient will make your life much easier.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation