I'm trying to submit a form with username and password to automate the login process but I'm stuck... I need to return the new URL after the form has been submitted. I've tried the following and don't get any errors but it doesn't return anything. URL url = new URL("https://manager.verisign.com/login/loginaction.cfm"); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setFollowRedirects(true); connection.addRequestProperty("partnerid","partnerid"); connection.addRequestProperty("login","login"); connection.addRequestProperty("password","password"); connection.connect(); Any help would be appreciated. Thanks, Dave
With addRequestProperty you are creating request header lines - not the same as what the servlet request contains when a form is submitted - which a program retrieves with getParameter("useid") - etc. With a GET request, the parameters come as part of the URL (you can see this in the URL for this page). With a POST request, the parameters come in the body of the request (after the headers) as name=value pairs Bill
Joined: Dec 16, 2003
So to automatically submit a prepopulated form to a website I need to do what? Do you have a simple example? Which classes do I need to use to accomplish this task? I'm pretty frustrated... I've been looking for an example of which classes to use and have come up dry all day long. Thanks Again, Dave
Whenevr I need to "remote control" another website I use HttpUnit it's positioned as a web testing tool, but is actually very good at controlling web applications, building and sending data, and processing the replies. One of my recent articles in The JavaRanch Journal covers a simple introduction how to do this.