0

我正在尝试登录网站并取回代码,但我收到“无效密码或登录名”,但我确定它们都可以

这是我的代码的一部分:

        HttpPost httppost = new HttpPost("http://www3.mackenzie.com.br/tia/index2.php");
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
        nameValuePairs.add(new BasicNameValuePair("username", username));
        nameValuePairs.add(new BasicNameValuePair("password", password));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);
        String str = inputStreamToString(response.getEntity().getContent()).toString();

我正在尝试访问此页面: http ://www3.mackenzie.com.br/tia/index2.php

我不确定是否应该输入“用户名”和“密码”或其他内容?我怎么能识别呢?我的问题可能是什么?

感谢您的帮助 =)

4

2 回答 2

1

对 Maxwell Weru 的回答稍作修改,我相信他的网址是错误的。& 添加了一个参数。

HttpPost httppost = new HttpPost("http://www3.mackenzie.com.br/tia/verifica.php");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("alumat", username));
nameValuePairs.add(new BasicNameValuePair("pass", password));
nameValuePairs.add(new BasicNameValuePair("unidade", "001"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
于 2012-06-19T20:27:02.183 回答
1

根据您提供的网站,我认为这是您应该编写代码的方式

HttpPost httppost = new HttpPost("http://www3.mackenzie.com.br/tia/index2.php");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("alumat", username));
nameValuePairs.add(new BasicNameValuePair("pass", password));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

特别强调增加的价值对

于 2012-06-19T20:09:08.413 回答