Action()
{
int iflen;//文件大小
long lfbody;//响应数据内容大小
char file[256]="";
char * chNumber ;
web_url("http://192.168.0.29:8086/fzb/pages/info_details.jsp?seq=5188&boardid=704&classcode=704",
"URL=http://192.168.0.29:8086/fzb/pages/info_details.jsp?seq=5188&boardid=704&classcode=704",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.0.29:8086/download.jsp?attachSeq=1049&filename=20090602143952348.doc",
"Snapshot=t2.inf",
"Mode=HTML",
EXTRARES,
"Url=../images/banner.swf", "Referer=http://192.168.0.29:8086/fzb/pages/info_details.jsp?seq=5188&boardid=704&classcode=704", ENDITEM,
"Url=/images/pattern00.gif", "Referer=http://192.168.0.29:8086/fzb/pages/info_details.jsp?seq=5188&boardid=704&classcode=704", ENDITEM,
"Url=../images/branch/tit.jpg", "Referer=http://192.168.0.29:8086/fzb/pages/info_details.jsp?seq=5188&boardid=704&classcode=704", ENDITEM,
"Url=../images/pattern_u_menu.gif", "Referer=http://192.168.0.29:8086/fzb/pages/info_details.jsp?seq=5188&boardid=704&classcode=704", ENDITEM,
LAST);
//设置最大长度
web_set_max_html_param_len("10000");
//将响应信息存放到fcontent变量
web_reg_save_param("fcontent", "LB=", "RB=", "SEARCH=BODY", LAST);
web_url("下载页面",
"URL=http://192.168.0.29:8086/download.jsp?attachSeq=1049&filename=20090602143952348.doc",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.0.29:8086/download.jsp?",
"Snapshot=t3.inf",
"Mode=HTML",
LAST);
//获取响应大小
//生成随机文件的名字
chNumber=lr_eval_string("{RandomNumber}"); //生成随机数
strcat(file,"c://下载文件结果/test");
strcat(file,chNumber);
strcat(file,".doc");
lr_output_message(lr_eval_string(file));
iflen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
if(iflen > 0)
{
//以写方式打开文件
if((lfbody = fopen(file, "wb")) == NULL)
{
lr_output_message("文件操作失败!");
return -1;
}
//写入文件内容
fwrite(lr_eval_string("{fcontent}"), iflen, 1, lfbody);
//关闭文件
fclose(lfbody);
}
return 0;
}