这是我的代码片段。我正在尝试使用HTTPOST登录到网站。 我不断收到“400错误请求”我尝试了各种组合。我尝试传递用户名/密码作为标题而不是NameValuePair。但结果相同。 有什么我失踪?为什么我得到Http/1.1 400错误的请求?
HttpClient httpclient = new DefaultHttpClient();
HttpPost post = new HttpPost("https://identi.ca/main/login");
List <NameValuePair> nvps = new ArrayList <NameValuePair>();
nvps.add(new BasicNameValuePair("nickname", u));
nvps.add(new BasicNameValuePair("password", p));
nvps.add(new BasicNameValuePair("submit", "Login"));
post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
HttpResponse response = httpclient.execute(post);
HttpEntity entity = response.getEntity();
Log.i("Login form POST result: ", response.getStatusLine().toString());
感谢您的帮助。
您需要向我们显示请求。尝试从日志中获取它。 – Zepplock 2011-04-04 01:39:45