取得关联的值问题
使用关联函数后取得不到里面的值。写到文件中的内容为空 。是不是哪里写错了脚本如下:
Action()
{
int flen; //定义一个整型变量保存获得文件的大小
int length;
long filedes; //保存文件句柄
char file="\0";//保存文件路径及文件名
char buffer="";
web_set_max_html_param_len("9999999");//设置页面接收最大的字节数,该设置应大于下载文件的大小
web_reg_save_param("filecontent",
"LB=<body>",
"RB=</body>",
"Search=ALL",
LAST);
lr_output_message(lr_eval_string("{filecontent}"));
flen = 650;
web_url("www.baidu.com",
"URL=http://www.baidu.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/img/i2.png", ENDITEM,
"Url=/img/arr.gif", ENDITEM,
"Url=/js/bdsug.js?v=1.0.3.0", ENDITEM,
"Url=/favicon.ico", "Referer=", ENDITEM,
LAST);
lr_save_string(lr_eval_string("{filecontent}"),"buffer");
lr_output_message("%s",buffer);
lr_output_message("%d",flen);
if(flen > 0)
{
if((filedes = fopen("d:\\test.txt", "wb")) == NULL)
{
lr_output_message("Open File Failed!", lr_eval_string("{filecontent}"));
return -1;
}
fwrite(buffer,flen,10,filedes );
fclose( filedes );
}
return 0;
}
日志结果如下:
Starting action Action.
Action.c(10): web_set_max_html_param_len was successful
Action.c(11): Registering web_reg_save_param was successful
Action.c(16): {filecontent}
Action.c(20): Found resource "http://www.baidu.com/img/baidu_sylogo1.gif" in HTML "http://www.baidu.com/"
Action.c(20): Found resource "http://gimg.baidu.com/img/gs.gif" in HTML "http://www.baidu.com/"
Action.c(20): Downloading resource "http://www.baidu.com/img/i2.png" (specified by argument number 9)
Action.c(20): Downloading resource "http://www.baidu.com/img/arr.gif" (specified by argument number 11)
Action.c(20): Downloading resource "http://www.baidu.com/js/bdsug.js?v=1.0.3.0" (specified by argument number 13)
Action.c(20): Downloading resource "http://www.baidu.com/favicon.ico" (specified by argument number 15)
Action.c(20): web_url("www.baidu.com") was successful, 9439 body bytes, 2232 header bytes
Action.c(34):
Action.c(35): 650
Ending action Action. 把关联函数的search=all改成1就会有结果了,整理错误比较多(概念问题) 回复 2# 云层
这里的搜索位置可以设置只有all、body、header 、No resources
刚才设置了一下报错了
Action.c(8): web_set_max_html_param_len was successful
Action.c(9): Error -27289: Unrecognized value ("1") for the "Search" argument (number 4)
Action.c(9): Registering web_reg_save_param highest severity level was "ERROR"
Ending action Action.
可能是我理解错了 能详细说下吗 自己结贴
页:
[1]