Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java I';我正在尝试使用android界面登录php站点,但我没有';我不知道如何发送数据_Java_Php_Android_Post_Get - Fatal编程技术网

Java I';我正在尝试使用android界面登录php站点,但我没有';我不知道如何发送数据

Java I';我正在尝试使用android界面登录php站点,但我没有';我不知道如何发送数据,java,php,android,post,get,Java,Php,Android,Post,Get,我试图登录到一个网站,并获得代码回来,但我得到了“无效密码或登录”,但我相信他们都是好的 以下是我的部分代码: HttpPost httppost = new HttpPost("http://www3.mackenzie.com.br/tia/index2.php"); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameVal

我试图登录到一个网站,并获得代码回来,但我得到了“无效密码或登录”,但我相信他们都是好的

以下是我的部分代码:

        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();
HttpPost-HttpPost=新的HttpPost(“http://www3.mackenzie.com.br/tia/index2.php");
List nameValuePairs=新的ArrayList(2);
添加(新的BasicNameValuePair(“用户名”,username));
添加(新的BasicNameValuePair(“密码”,password));
setEntity(新的UrlEncodedFormEntity(nameValuePairs));
//执行HTTP Post请求
HttpResponse response=httpclient.execute(httppost);
字符串str=inputStreamToString(response.getEntity().getContent()).toString();
我正在尝试访问此页面:

我不确定是否应该输入“用户名”和“密码”或其他内容?我怎样才能确定这一点? 我的问题是什么,伙计们


感谢您的帮助=)

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

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));
HttpPost-HttpPost=新的HttpPost(“http://www3.mackenzie.com.br/tia/index2.php");
List nameValuePairs=新的ArrayList(2);
添加(新的BasicNameValuePair(“alumat”,用户名));
添加(新的BasicNameValuePair(“pass”,password));
setEntity(新的UrlEncodedFormEntity(nameValuePairs));

特别注意增加的价值对

对Maxwell Weru的答案稍加修改,我相信他的url是错误的添加了一个参数

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=新的HttpPost(“http://www3.mackenzie.com.br/tia/verifica.php");
List nameValuePairs=新的ArrayList(2);
添加(新的BasicNameValuePair(“alumat”,用户名));
添加(新的BasicNameValuePair(“pass”,password));
添加(新的BasicNameValuePair(“unidade”、“001”);
setEntity(新的UrlEncodedFormEntity(nameValuePairs));

我尝试使用Chrome的开发者控制台登录(只是虚拟值)。从这里我可以看到浏览器和网站之间的所有交易。我查找了“post”,尝试登录后的第一个是带我列出的三个参数的“”。