Here’s my code:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.webcitation.org/comb.php");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair(??, ??));
nameValuePairs.add(new BasicNameValuePair("fromform", "2"));
nameValuePairs.add(new BasicNameValuePair("email", "example@example.com"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while((line = rd.readLine()) != null) {
System.out.println(line);
}
} catch (Exception e) {
System.out.println(e);
}
And here’s the HTML code of the form I’m trying to mimic: http://www.webcitation.org/69Qsz3Tdn
I’m trying to submit the URLs http://video.google.com/?hl=en&tab=wv, http://maps.google.com/maps?hl=en&tab=wl, etc. to the PHP file through Java and read the response. Since there are no names for the hrefs, I’m stumped. Also the checkboxes have no values, so I can’t check whether they are checked or not.
Thanks for any assistance!!
You’ll not get the expected response.
The response from comb.php depends on a html form.
in your html form values are not specified. So I can not see how comb.php test the checkboxes.
with value :
1.) You also need a java App with a GUI like form (example a Swing-form App). There you can check or uncheck the needed checkboxes.
2.) You have to pass appropriate variables to comb.php. For Example: