我正在尝试登录站点并取回代码,但我得到"密码或登录无效",但我相信它们都没问题
这是我代码的一部分:
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
我不确定我是否应该输入"用户名"和"密码"或其他东西? 我该如何识别?伙计们,我的问题可能是什么?
感谢您的帮助=)
对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));
根据您提供的网站,我认为这是您应该编写代码的方式
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));
特别强调增加的价值对