new Thread()
{
@Override
public void run()
{
try
{
HttpPost post = new HttpPost("http://news.gdut.edu.cn/"
+ "ArticleList.aspx?category=4");//③
// 如果传递参数个数比较多的话可以对传递的参数进行封装
List<NameValuePair> params = new
ArrayList<NameValuePair>();
params.add(new BasicNameValuePair
("ctl00$ContentPlaceHolder1$userEmail", name));
params.add(new BasicNameValuePair
("ctl00$ContentPlaceHolder1$userPassWord", pass));
// 设置请求参数
post.setEntity(new UrlEncodedFormEntity(
params, HTTP.UTF_8));
// 发送POST请求
HttpResponse response = httpClient
.execute(post); //④
// 如果服务器成功地返回响应
if (response.getStatusLine()
.getStatusCode() == 200)
{
String msg = EntityUtils
.toString(response.getEntity());
Looper.prepare();
// 提示登录成功
Toast.makeText(HttpClientTest.this,
msg, Toast.LENGTH_SHORT).show();
Looper.loop();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}.start();
但是返回的还是这个登陆界面的内容,那么怎么得到登录后的页面内容??