【问题标题】:Android https form submission?Android https 表单提交?
【发布时间】:2011-08-15 22:08:16
【问题描述】:

您好,我在提交简单表单时遇到了很多麻烦,我四处搜索,似乎有不少人遇到过同样的问题,但我没有找到答案。

到目前为止,这是我的代码:

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);

}

上面的代码只会返回原始页面,

谁能帮帮我?

谢谢

【问题讨论】:

    标签: java android http https


    【解决方案1】:

    您确定 URL 支持通过这种方式通过帖子登录吗?在我看来,登录表单将帖子数据发送到此 URL:https://www.mymeteor.ie/go/mymeteor-login-manager

    我还怀疑您应该使用某种 API,而不仅仅是远程将数据发布到他们的登录表单。

    【讨论】:

    • 我不确定我会尝试那个网址,很遗憾他们没有提供任何 api 谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 2010-09-21
    • 1970-01-01
    • 2010-12-24
    • 2012-06-23
    相关资源
    最近更新 更多