求android大神说说为什么我这样获取不到网页验证码图片?
HttpPost httpPost = new HttpPost("cas.gzccc.edu.cn/lyuapServer/captcha.htm");
HttpResponse httpResponse = client.execute(httpPost);
COOKIE = ((AbstractHttpClient) client).getCookieStore().getCookies().get(0).getValue();
byte[] bytes = EntityUtils.toByteArray(httpResponse.getEntity());
Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
return bitmap;
我是做教务系统客户端的。但是网上的那个DEMO的这段代码无法解析得到图片,一直卡在这里
唉!还是自己解决了,原来是http和https的问题
http://download.csdn.net/download/u010538765/5976773
也是需要细心的问题,
1)倒回来检查一下你的数据长度
2)post后面的地址格式是否有问题,我没这样写过
3)看一下你是如何new client的
4)确定服务端发送没错吗?
5)版本问题你用的httpclient是什么版本,httpclient更新比较快,有的版本使用有差别
或者换过一个demo,注意人家是用什么版本的demo
cas.gzccc.edu.cn/lyuapServer/captcha.htm 404
图片地址。。。存在吗?