int web_save_param_length(const char * Param,const char * Base,LAST);
参数说明:
Param:保存长度的参数的名称。
Base:参数中的长度的表示。 基于是Decimal or Hexadecimal(十进制或十六进制之一)
具体使用参考搜狗浏览器下载脚本
Action() { int flen; //定义一个整型变量保存获得文件的大小 long filedes; //保存文件句柄 char file[256]="\0"; //保存文件路径及文件名 char * chNumber ; int time; long lfbody; web_set_max_html_param_len("80000000"); //设置页面接收最大的字节数,该设置应大于下载文件的大小 // lr_rendezvous("下载"); 67472237 web_concurrent_start(NULL);//并发开始 web_reg_save_param("filecontent","LB=","RB=","Search=BODY",LAST); //使用关联函数获取下载文件的内容 web_url("sougou_browser", "URL=https://dlie.sogoucdn.com/se/sogou_explorer_8.6_1120.exe",//下载链接 "Resource=1", "RecContentType=application/force-download", "Referer=", LAST); web_concurrent_end(NULL); //并发结束 web_save_param_length("filecontent", "Base=Decimal", LAST); flen = atoi(lr_eval_string("{filecontent_Length}")); //flen =web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE); //获得下载文件大小 lr_output_message("下载文件大小是%d",flen); time=web_get_int_property (HTTP_INFO_DOWNLOAD_TIME); lr_output_message("下载时间是%d",time); chNumber="sougoubrowser"; //生成随机数 strcat(file,"F:\\");//将下载文件要保存的路径存到android里 strcat(file,chNumber);//在文件名后自动生成随机数 strcat(file,".exe");//下载的文件后缀名称 if(flen > 0) { //以写方式打开文件 if((lfbody = fopen(file,"wb")) == NULL) { lr_output_message("文件操作失败!"); return -1; } //写入文件内容 fwrite(lr_eval_string("{filecontent}"),flen,1,lfbody); //关闭文件 fclose(lfbody); } return 0; }
Action() { web_reg_save_param("A", "LB=[bnum++]=\"", "RB=\";", "ORD=ALL", LAST); web_url("test", "URL=http://localhost/test.html", "Resource=0", "Referer=", "Snapshot=t1.inf", "Mode=HTML", LAST); lr_output_message("%s",lr_eval_string("{A_2}")); lr_output_message("%s",lr_eval_string("{A_count}")); web_save_param_length("A_2", "Base=Hexadecimal", LAST); web_save_timestamp_param("tStamp", LAST); lr_output_message("%s",lr_eval_string("{tStamp}")); return 0; } 执行结果为: Action.c(19): Notify: Saving Parameter "A_2_Length = 8" Action.c(20): Notify: Saving Parameter "tStamp = 1341454346975" 分别获得了A_2 的长度和时间戳