|
我之前遇到过“下载功能”这方面的问题,需要在原有脚本的基础上添加以下代码
web_set_max_html_param_len("200000000"); //设置参数的最大长度,注意该值必须大于文件的大小
web_reg_save_param("fcontent", "LB=", "RB=", "SEARCH=BODY", LAST);
web_url("BaseAttachManageDownload.jsp",
"URL=http://192.168.101.24:3045/ultrawf/UltraWF/manageprocess/BaseAttachManageDownload.jsp? attID=000000000005826",
"Resource=0",
"RecContentType=text/html", "Referer=http://192.168.101.24:3045/ultrawf/UltraWF/manageprocess/BaseAttachManageDownlo
ad.jsp?attID=000000000005826",
"Snapshot=t16.inf",
"Mode=HTML",
EXTRARES,
"Url=BaseAttachManageDownload.jsp?attID=000000000005826",
"Referer=http://192.168.101.24:3045/ultrawf/UltraWF/manageprocess/BaseAttachManageDownload.jsp?attID=000000000005826",
ENDITEM,
LAST); //获取响应的全部内容,作为文件内容保存
flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
chNumber=lr_eval_string("{NewParam}"); //生成随机数,参数化
if(flen >450)
{
strcpy(wxdong,"D:\\test");
strcat(wxdong,chNumber);
strcat(wxdong,".zip"); //最后保存为D盘,文件名字为‘chNumber’.zip
//以写方式打开文件
if((filedes = fopen(wxdong, "wb+")) == NULL)
{
lr_output_message("Open File Failed!");
return -1;
}
//写入文件内容
fwrite(lr_eval_string("{fcontent}"), flen, 1, filedes);
//关闭文件
fclose(filedes);
}
return 0;
}
希望对你有启发 |
|