try {
URL url = new URL(html);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
String urlParameters = "symbol="+symbol+"&Submit=Submit";
connection.setRequestMethod("POST");
connection.setRequestProperty("USER-AGENT","Mozilla/5.0");
connection.setRequestProperty("ACCEPT-LANGUAGE","en-US,en;0.5");
connection.setDoOutput(true);
DataOutputStream dstream = new DataOutputStream(connection.getOutputStream());
dstream.writeBytes(urlParameters);
dstream.flush();
dstream.close();
int responseCode = connection.getResponseCode();
String output = "Request Url"+ url;
output += System.getProperty("line.separator") + "Request Parameters" + urlParameters;
output += System.getProperty("line.separator") + "Response Code" + responseCode;
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line ="";
StringBuilder responseOutput = new StringBuilder();
while((line = br.readLine()) != null){
responseOutput.append(line);
}
br.close();
output += System.getProperty("lin.separator") + responseOutput.toString();
textView.setText(output);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
我想做的是提交一个我在网站上制作的表格,该表格可以接收张贴数据。 表格如下:
我正在尝试使用该应用程序提交表单...然后重定向到另一个显示学生标记的网址。