android http post登录my.beeline.ru

时间:2013-07-03 21:28:29

标签: java android post httpclient

首先:对不起我的英语。

我需要登录网站https://my.beeline.ru/mLogin.html。我写了下一段代码:

HttpClient httpClient = new DefaultHttpClient();
HttpParams httpParams = httpClient.getParams();

HttpConnectionParams.setConnectionTimeout(httpParams, REGISTRATION_TIMEOUT);
HttpConnectionParams.setSoTimeout(httpParams, WAIT_TIMEOUT);
ConnManagerParams.setTimeout(httpParams, WAIT_TIMEOUT);

HttpPost httpPost = new HttpPost(request.getUrl());
List<Option> optionList = request.getOptions();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(optionList.size());
for (Option option : optionList) {
    String value = option.getValue();
    if (option.getValue().equals(ACCOUNT_NAME)) value = account.getLogin();
    if (option.getValue().equals(ACCOUNT_PASSWORD)) value = account.getPassword();
    nameValuePairs.add(new BasicNameValuePair(option.getName(), value));
}

httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
response = httpClient.execute(httpPost);
String content = EntityUtils.toString(response.getEntity(), "UTF-8");

在“字符串内容”中,a接收状态码为200的第一个登录页面,没有任何错误或其他内容。但是当我在http://uslugi.beeline.ru更改网址而不更改代码时 - 身份验证成功。任何人都可以帮忙,发帖请求有什么问题?

0 个答案:

没有答案