|
我自己的LR下载文件脚本,供参考(楼主记得下载文件调试时不要打开Parameter Substitution日志选项,否则下载过程非常慢,甚至死机):
int iflen;
long lfbody;
web_set_max_html_param_len("10000");
lr_start_transaction("Download");
web_reg_save_param("fileContent",
"LB/BIN=",
"RB/BIN=",
"Search=Body",
LAST);
web_url("getfile",
"URL=http://moggie/learn/test.doc",
"Resource=0",
"Referer=",
"Mode=HTML",
LAST);
iflen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
if(iflen > 0) {
if((lfbody = fopen("c:\\test.doc", "wb")) == NULL) {
lr_output_message("文件操作失败!");
return -1;
}
fwrite( lr_eval_string("{fileContent}"), iflen, 1, lfbody );
fclose( lfbody );
}
lr_end_transaction("Download", LR_AUTO); |
|