File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/test/java/com/tgb/ccl/http Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,14 @@ public static void main(String[] args) throws HttpProcessException {
31
31
//C币查询
32
32
String scoreUrl = "http://my.csdn.net/my/score" ;
33
33
34
+ //定义cookie存储
34
35
HttpClientContext context = new HttpClientContext ();
35
36
CookieStore cookieStore = new BasicCookieStore ();
36
37
context .setCookieStore (cookieStore );
38
+
37
39
//获取参数
38
40
String loginform = HttpClientUtil .send (loginUrl , context );
39
- // System.out.println(loginform);
41
+ // System.out.println(loginform);
40
42
System .out .println ("获取登录所需参数" );
41
43
String lt = regex ("\" lt\" value=\" ([^\" ]*)\" " , loginform )[0 ];
42
44
String execution = regex ("\" execution\" value=\" ([^\" ]*)\" " , loginform )[0 ];
@@ -52,7 +54,7 @@ public static void main(String[] args) throws HttpProcessException {
52
54
53
55
//发送登录请求
54
56
String result = HttpClientUtil .send (loginUrl , map , context );
55
- // System.out.println(result);
57
+ // System.out.println(result);
56
58
if (result .contains ("帐号登录" )){//如果有帐号登录,则说明未登录成功
57
59
String errmsg = regex ("\" error-message\" >([^<]*)<" , result )[0 ];
58
60
System .err .println ("登录失败:" +errmsg );
You can’t perform that action at this time.
0 commit comments