|
本帖最后由 yangshuxin1989 于 2012-10-11 16:30 编辑
这几天在根据云老师的这篇文章在做验证码识别~然后想实践到自己工作的登录项目中,但是遇到一点问题呀~请各位高手指教一下。那个验证码是一个链接,我怎么知道每次请求的是什么呀~我直接把云层老师的代码插入到我的脚本中(当然,验证码的链接已经修改了),但是还是返回一个1006码,提示验证码错误。- Action()
- {
- int flen; //定义一个整型变量保存获得文件的大小
- long filedes; //保存文件句柄
- char file[256]="c:\\test1.jpg"; //保存文件路径及文件名
- char result[4];
- char res[4];
- web_url("www.efunfun.com",
- "URL=http://www.efunfun.com/",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=",
- "Snapshot=t1.inf",
- "Mode=HTML",
- LAST);
- web_url("login.do",
- "URL=http://login.efunfun.com/login.do?method=js_isLogin&callback=rq.bd%5B1%5D=&ck=20121011161946664&rdm=0.4956840199491224",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://www.efunfun.com/",
- "Snapshot=t2.inf",
- "Mode=HTML",
- LAST);
- web_url("login.do_2",
- "URL=http://login.efunfun.com/login.do?method=js_getUser&callback=rq.bd%5B2%5D=&ck=20121011161946664&rdm=0.22612070868305833",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://www.efunfun.com/",
- "Snapshot=t3.inf",
- "Mode=HTML",
- LAST);
- lr_think_time(6);
- web_set_max_html_param_len("2000000");//设置页面接收最大的字节数,该设置应大于下载文件的大小
- web_reg_save_param("pic",
- "LB=",
- "RB=",
- "Ord=1",
- "Search=Body",
- LAST);
- web_url("randpiccloud","URL=http://login.efunfun.com/verify_ck.jsp?ck={num1}&ram={num}",LAST);
-
- flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE); //获得文件大小
- if(flen > 0)
- {
- if((filedes = fopen(file, "wb")) == NULL)
- {
- lr_output_message("oh cloud your Open File Failed!");
- return -1;
- }
- fwrite( lr_eval_string("{pic}"),flen,1,filedes );
- fclose( filedes );
- }
- system("c:\\test.bat");;
-
- if((filedes = fopen("c:\\test.txt", "rt")) == NULL)
- {
- lr_output_message("oh,cloud your Open File Failed!");
- return -1;
- }
- fread( result,4,1,filedes);
- fclose( filedes );
- lr_output_message(result);
- lr_save_var(result,4,0,"res");
- //lr_output_message(res);
- lr_output_message(lr_eval_string("{res}"));
- lr_save_string(res,"a");
- web_url("login.do_3",
- "URL=http://login.efunfun.com/login.do?method=js_login&u=shuxin@qq.com&p=1qaz2wsx&c={a}&callback=rq.bd%5B4%5D=&ck=20121011161946664&rdm=0.2209274314358045",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://www.efunfun.com/",
- "Snapshot=t4.inf",
- "Mode=HTML",
- LAST);
- web_url("www.efunfun.com_2",
- "URL=http://www.efunfun.com/?",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=",
- "Snapshot=t5.inf",
- "Mode=HTML",
- LAST);
- web_url("login.do_4",
- "URL=http://login.efunfun.com/login.do?method=js_isLogin&SessionID=638ec38ee80c524d789c103a3b29984f&userid=-1&callback=rq.bd%5B1%5D=&ck=20121011162003623&rdm=0.08463324298331681",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://www.efunfun.com/?",
- "Snapshot=t6.inf",
- "Mode=HTML",
- LAST);
- web_url("login.do_5",
- "URL=http://login.efunfun.com/login.do?method=js_getUser&SessionID=638ec38ee80c524d789c103a3b29984f&userid=-1&callback=rq.bd%5B2%5D=&ck=20121011162003623&rdm=0.1782930045923139",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://www.efunfun.com/?",
- "Snapshot=t7.inf",
- "Mode=HTML",
- LAST);
- return 0;
- }
复制代码 |
|