这是我的代码:
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);
}
这是我试图模仿的表单的 HTML 代码:http ://www.webcitation.org/69Qsz3Tdn
我正在尝试通过 Java 将 URL http://video.google.com/?hl=en&tab=wv
、http://maps.google.com/maps?hl=en&tab=wl
等提交到 PHP 文件并读取响应。由于s没有name
s href
,我很难过。复选框也没有value
s,所以我无法检查它们是否被选中。
感谢您的帮助!!