该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
String loginurl="https://v4.passport.sohu.com/i/login/101305"
String userid=url;
String password=md5Util.Pd(passwords);
System.out.println(password);
String appid="101305";
String callback="";
//登录所需参数
List list=new ArrayList();
list.add(new BasicNameValuePair("userid", userid));
list.add(new BasicNameValuePair("password", password));
list.add(new BasicNameValuePair("appid", appid));
//list.add(new BasicNameValuePair("callback", callback));
//发送请求
HttpPost httpPost=new HttpPost(loginurl);
UrlEncodedFormEntity uefEntity=new UrlEncodedFormEntity(list, "UTF-8");
httpPost.setEntity(uefEntity);
//设置头部参数
httpPost.setHeader("Content-Type","text/html;charset=UTF-8");
httpPost.setHeader("User-Agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0");
//接收相应
CloseableHttpResponse response=httpclient.execute(httpPost, context);
System.out.println("状态码"+response.getStatusLine().getStatusCode());
HttpEntity Entity=response.getEntity();
String result=EntityUtils.toString(Entity,"utf-8");
System.out.println("登录结果"+result);