I have with me a php script that can fill in multiple similar web forms easily- what it does is, asks for the values (required by each form) from the user initially, then one-by-one, it opens a form (filling in all values asked from the user) and shows only captcha and multiple choice value of "Category" on screen. Now end user has to fill in captcha and multiple choice value. After that, the php script submits the form successfully.
What I want you to do is to convert this php code into java. The php script requires "curl" library- there is a workaround for this also-- We can take advantage of libcurl straight from within Java programs using this binding. All you need to do is to get the 'curl-java' package and use it! Refer [url removed, login to view] for more details.
OK, the main task of php code is to show only captcha and one category value on screen, and then(after user has filled in captcha and category) fill in other fields automatically and then submit the form. I want you to make the java equivalent of this, with the following in mind-
(1) Currently the list of fields for each form, is hardcoded in php code. I want your java code to have a function that accepts a list of fields as input parameter. SO if I want to submit data to a different form, then I can accordingly give as parameters to your function, the list of fields required by that form.
(2) Currently only one multiple choice value- "Category" is shown on screen - again I want that I can pass as parameter to your function a list of multiple choice fields, so that these can then be displayed on screen.
(3) Full response message (whether error or success) should be logged by your function. Ideally I want your code to give the exact response message, however if you can even store the full response in a file on server that is also acceptable.
Before I accept your work as complete, create 2 working samples of your function for me- one should submit data and captcha to a web form with regular captcha, the second form should submit data to a web form with recaptcha.
Simple work for a good php/java coder.
Your code will be used in a jsp web application. It may also be used in a java desktop application.
Pls refer additional information also...
(4) I should be able to submit data to multiple forms simultaneously using your code. (Current php code submits data to one form at a time)
So for your function, one input parameter is the list of form URLs, one input parameter is list of fields in each form, one input parameter is list of multiple choice values (like radio button/check box or other type) and one parameter is the list of actual values (corresponding to the list of fields parameter ie the values to be filled in for various fields in each form)... Also I should be able to submit data to multiple forms with each form having a different set of fields/multiple choice values. The method (Get or Post) should also be passed as a parameter to your function.
Finally, I should be able to use your code to register as a new user at a website, then login and finally submit data (after logging in). I think this requires cookies but you will have to ensure that I am able to do this...Also both GET and POST requests should be supported by your code.
The entire php script is attached with this project as a zip file.
Please refer "[url removed, login to view]" in the zip file to see the relevant php code that has to be converted into java.
You can see a working demo of this work by going to [url removed, login to view] and login with user='arvindikchari' and password='password'.
Now in left hand side menu go to "Directory Submission" under this click on "Start Submitting". Now you can see the action of showing only captcha + category on screen, and then autosubmission of form (after user has filled values for captcha and category).