苦恼啊 帮我解决这个问题我愿意付现金
写了一个android登陆论坛的程序 但是怎么都登陆不上去 到底问题是什么呢 郁闷呐List <NameValuePair> params = new ArrayList <NameValuePair>();
params.add(new BasicNameValuePair("username",UserName));
params.add(new BasicNameValuePair("password", Password));
String sourceString = Net.getInstance().post("http://zhixing.bjtu.edu.cn/member.php?mod=logging&action=login", params);
Net.getInstance().post函数是这样的
public String post(String URL,List <NameValuePair> params) throws Exception
{
String resultString;
try {
HttpPost httpRequest = new HttpPost(URL);
// httpRequest.setEntity(new UrlEncodedFormEntity(params, "GB2312"));
httpRequest.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
HttpResponse httpResponse = client.execute(httpRequest);
if(httpResponse.getStatusLine().getStatusCode() == 200)
{
resultString= readstream(httpResponse.getEntity().getContent());
Log.v(URL, resultString);
}else {
throw new Exception("can't connect the network");
}
return resultString;
}catch (Exception e) {
throw e;
}
}
每次都是登陆失败 帮忙看看有什么问题 --------------------编程问答-------------------- 你可以先看看我这篇博客
android 登录Javaeye(使用HttpURLConnection和HttpClient)
http://blog.csdn.net/dellheng/article/details/7063373
--------------------编程问答-------------------- 可能是没有权限吧,:-) --------------------编程问答-------------------- 这个我比较熟悉,服务器和客户端都有问题可能出现 --------------------编程问答-------------------- 全程要保持整个会话。。。so,在第一次登陆的时候会有个session id,之后每次都要带上你的id
补充:移动开发 , Android