51Testing软件测试论坛
标题:
关于关联函数web_reg_save_param的疑问
[打印本页]
作者:
myallways
时间:
2011-5-15 20:07
标题:
关于关联函数web_reg_save_param的疑问
#include "web_api.h"
Action()
{
int flen;
long filedes;
web_url("index.asp",
"URL=http://www.testage.net/bbs/index.asp?boardid=25",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/index.asp",
"Snapshot=t8.inf",
"Mode=HTML",
LAST);
lr_think_time( 17 );
web_url("statonline.asp_3",
"URL=http://www.testage.net/Count/statonline.asp",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/index.asp?boardid=25",
"Snapshot=t9.inf",
"Mode=HTML",
LAST);
web_url("counter.asp_3",
"URL=http://www.testage.net/Count/counter.asp?style=none&Referer=http%3A//www.testage.net/bbs/index.asp&Timezone=-480&Width=1024&Height=768&Color=32",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/index.asp?boardid=25",
"Mode=HTML",
LAST);
web_url("CounterLink.asp",
"URL=http://www.testage.net/Count/CounterLink.asp?style=none",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/index.asp?boardid=25",
"Snapshot=t10.inf",
"Mode=HTML",
LAST);
web_url("statonline.asp_4",
"URL=http://www.testage.net/Count/statonline.asp",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/index.asp?boardid=25",
"Snapshot=t11.inf",
"Mode=HTML",
LAST);
web_url("counter.asp_4",
"URL=http://www.testage.net/Count/counter.asp?style=none&Referer=http%3A//www.testage.net/bbs/index.asp&Timezone=-480&Width=1024&Height=768&Color=32",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/index.asp?boardid=25",
"Mode=HTML",
LAST);
web_url("Online.asp_3",
"URL=http://www.testage.net/bbs/Online.asp?action=1&boardid=25",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/index.asp?boardid=25",
"Snapshot=t12.inf",
"Mode=HTML",
LAST);
web_url("index.asp_2",
"URL=http://www.testage.net/bbs/index.asp?action=xml",
"Resource=0",
"RecContentType=text/xml",
"Referer=http://www.testage.net/bbs/index.asp?boardid=25",
"Snapshot=t13.inf",
"Mode=HTML",
EXTRARES,
"Url=skins/Default/plus.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/default/Forum_nav.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/ztop.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/filetype/gif.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/pagelist.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/lockfolder.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/hotfolder.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/filetype/bmp.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=images/pagelist/First.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=images/pagelist/Last.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/css/default/topbg.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/dvmenubg3.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/css/default/tabs_m_tile.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/navspacer.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/postnew.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/votenew.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/css/default/bg1.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/xzb.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/team2.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/ao.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/messages2.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/closedb.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/nofollow.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/ztop1.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/istop.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/isbest.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/filetype/rar.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/css/default/bottombg.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
"Url=skins/Default/alipay.gif", "Referer=http://www.testage.net/bbs/index.asp?boardid=25", ENDITEM,
LAST);
lr_think_time( 6 );
web_url("dispbbs.asp",
"URL=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/index.asp?boardid=25",
"Snapshot=t14.inf",
"Mode=HTML",
LAST);
web_url("index.asp_3",
"URL=http://www.testage.net/bbs/index.asp?action=xml",
"Resource=0",
"RecContentType=text/xml",
"Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1",
"Snapshot=t15.inf",
"Mode=HTML",
EXTRARES,
"Url=skins/Default/dvmenubg3.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/css/default/bottombg.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/navspacer.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/postnew.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/alipay.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/votenew.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/mreply.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/css/default/bg1.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/css/default/topbg.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
"Url=skins/Default/css/default/tabs_m_tile.gif", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
LAST);
//设置参数的最大长度,注意该值必须大于文件的大小
web_set_max_html_param_len("20000");
//获取响应的全部内容,作为文件内容保存
web_reg_save_param("fcontent", "LB=", "RB=", "SEARCH=BODY", LAST);
web_url("viewfile.asp",
"URL=http://www.testage.net/bbs/viewFile.asp?BoardID=25&ID=217",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1",
"Snapshot=t16.inf",
"Mode=HTML",
EXTRARES,
"Url=viewFile.asp?BoardID=25&ID=217", "Referer=http://www.testage.net/bbs/dispbbs.asp?boardID=25&ID=5187&page=1", ENDITEM,
LAST);
//获取响应中的文件长度
flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
if(flen > 0)
{
//以写方式打开文件
if((filedes = fopen("c:\\test.rar", "wb")) == NULL)
{
lr_output_message("Open File Failed!");
return -1;
}
//写入文件内容
fwrite(lr_eval_string("{fcontent}"), flen, 1, filedes);
//关闭文件
fclose(filedes);
}
return 0;
}
大家好,相信大家都见过这段文件下载的代码,看了一下
//获取响应的全部内容,作为文件内容保存
web_reg_save_param("fcontent", "LB=", "RB=", "SEARCH=BODY", LAST);
这个关联函数没有看懂,这个左右边界是怎么得到的?麻烦明白人给说一下,不胜感激,谢谢!
作者:
wozeny
时间:
2011-5-17 13:52
回复
1#
myallways
这里的这个关联函数没有设置左右边界,在整个body中查找
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2