Java Android https表单提交?
嗨,我在提交一个简单的表格时遇到了很多麻烦,我四处搜索了一下,似乎有很多人遇到了同样的问题,但我没有找到答案 以下是我目前的代码:Java Android https表单提交?,java,android,http,https,Java,Android,Http,Https,嗨,我在提交一个简单的表格时遇到了很多麻烦,我四处搜索了一下,似乎有很多人遇到了同样的问题,但我没有找到答案 以下是我目前的代码: public void postData(TextView txtResult, String user, String pass) throws ClientProtocolException, IOException { HttpPost post = new HttpPost("https://www.mymeteor.ie"); Lis
public void postData(TextView txtResult, String user, String pass) throws ClientProtocolException, IOException {
HttpPost post = new HttpPost("https://www.mymeteor.ie");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("username", user));
nameValuePairs.add(new BasicNameValuePair("userpass", pass));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post);
HttpEntity entity = response.getEntity();
String responseText = EntityUtils.toString(entity);
txtResult.setText(responseText);
}
public void postData(TextView-txtreult、String-user、String-pass)抛出ClientProtocolException、IOException{
HttpPost=新的HttpPost(“https://www.mymeteor.ie");
List nameValuePairs=新的ArrayList(2);
添加(新的BasicNameValuePair(“用户名”,用户));
添加(新的BasicNameValuePair(“userpass”,pass));
setEntity(新的UrlEncodedFormEntity(nameValuePairs));
HttpClient=new DefaultHttpClient();
HttpResponse response=client.execute(post);
HttpEntity=response.getEntity();
String responseText=EntityUtils.toString(实体);
txtreult.setText(responseText);
}
上面的代码只会返回原始页面
有人能帮我吗
谢谢您确定URL支持以这种方式通过post登录吗?在我看来,登录表单将post数据发送到此URL:
https://www.mymeteor.ie/go/mymeteor-login-manager
我还怀疑您应该使用某种API,而不是将数据远程发布到他们的登录表单。我根本不确定是否会尝试该url,不幸的是,他们没有提供任何API,谢谢。