SDProgrammer 2015-11-26 10:51 采纳率: 0%
浏览 1716

关于用http client模拟登录教务系统的问题 跪求大神指点!

response = httpclient.execute(httppost,context);
String result = response.getStatusLine().toString();
System.out.println(result);
HttpEntity entity1 = response.getEntity();
System.out.println(EntityUtils.toString(entity1));
Header locationHeader =response.getFirstHeader("location");

System.out.println(locationHeader.toString());

             String newuri = "http://jwxt1.cumt.edu.cn"+locationHeader.getValue(); 


         System.out.println(result);     
            HttpGet redirect=new HttpGet(newuri);  

            CloseableHttpResponse response1=httpclient.execute(redirect,context);  
            HttpEntity entity = response1.getEntity();
              System.out.println(EntityUtils.toString(entity)); 


            redirect.releaseConnection();  

返回的结果```
HTTP/1.1 302 Moved Temporarily

Object moved

Object moved to here.

Location: /xs_main.aspx?xh=我的学号

用httpclient模拟登陆学校的方正教务系统 post数据以后再获取重定向的地址进行get访问 为何不行


  • 写回答

4条回答 默认 最新

  • 花前月下的细说 2015-11-26 11:29
    关注

    可以试着用OKhttp试一下

    评论

报告相同问题?

悬赏问题

  • ¥20 蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏