关于怎么在LR中模拟下载的动作(选自51testing)

#include "as_web.h"

Action()
{
long i,fp;
 web_add_cookie("sid=26CE7C; DOMAIN=www.51testing.com");
 web_add_cookie("_cookietime=31536000; DOMAIN=www.51testing.com");
 web_add_cookie("_discuz_uid=2327; DOMAIN=www.51testing.com");
 web_add_cookie("_discuz_pw=6cd9c1d7e2498582eddcf7a91a936c06; DOMAIN=www.51testing.com");
 web_add_cookie("_discuz_secques=6ccf9bcd; DOMAIN=www.51testing.com");
 web_add_cookie("oldtopics=%096342%09; DOMAIN=www.51testing.com");
 web_url("[url]www.51testing.com[/url]",
  "URL=http://www.51testing.com/",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t4.inf",
  "Mode=HTML",
  LAST);
 web_url("opsdirective.xml",
  "URL=http://toolbar.msn.com/static/msntbs15/opsdirective.xml?type=2",
  "Resource=0",
  "RecContentType=text/xml",
  "Referer=",
  "Snapshot=t5.inf",
  "Mode=HTML",
  LAST);
 web_url("index.htm",
  "URL=http://www.51testing.com/index/index.htm",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t6.inf",
  "Mode=HTML",
  EXTRARES,
  "Url=lib/flash/logo.swf", "Referer=", ENDITEM,
  "Url=lib/flash/title.swf", "Referer=", ENDITEM,
  "Url=../common/lib/liuchengxx1.swf", "Referer=", ENDITEM,
  LAST);
 web_link("51Testing软件测试论坛",
  "Text=51Testing软件测试论坛",
  "Snapshot=t7.inf",
  EXTRARES,
  "Url=p_w_picpaths/default/bg.gif", ENDITEM,
  "Url=flash/title.swf", "Referer=", ENDITEM,
  "Url=p_w_picpaths/default/headerbg.gif", ENDITEM,
  "Url=p_w_picpaths/default/catbg.gif", ENDITEM,
  LAST);
 lr_think_time( 3 );
 web_link("[LoadRunner]",
  "Text=[LoadRunner]",
  "Snapshot=t8.inf",
  EXTRARES,
  "Url=p_w_picpaths/default/bg.gif", "Referer=http://www.51testing.com/cgi-bin/forumdisplay.php?fid=67", ENDITEM,
  "Url=flash/title.swf", "Referer=", ENDITEM,
  "Url=p_w_picpaths/default/headerbg.gif", "Referer=http://www.51testing.com/cgi-bin/forumdisplay.php?fid=67", ENDITEM,
  LAST);
 lr_think_time( 1 );
 web_link("我编写了一个小脚本,其中讲叙了怎样做关联,怎样写custom request供大家参考",
  "Text=我编写了一个小脚本,其中讲叙了怎样做关联,怎样写custom request供大家参考",
  "Snapshot=t9.inf",
  EXTRARES,
  "Url=p_w_picpaths/default/bg.gif", "Referer=http://www.51testing.com/cgi-bin/viewthread.php?tid=13860&fpage=1", ENDITEM,
  "Url=flash/title.swf", "Referer=", ENDITEM,
  "Url=p_w_picpaths/default/headerbg.gif", "Referer=http://www.51testing.com/cgi-bin/viewthread.php?tid=13860&fpage=1", ENDITEM,
  LAST);

 lr_start_transaction("DownLoad");
    fp = fopen("c:\\flight.rar","wb");
    web_set_max_html_param_len("500000");
    web_reg_save_param("FILED","LB=","RB=","Search=Body",LAST);
 web_link("flight_script13.rar",
  "Text=flight_script13.rar",
  "Snapshot=t10.inf",
  LAST);
   i = web_get_int_property( HTTP_INFO_DOWNLOAD_SIZE );
   if (i>0)
  {
     fwrite(lr_eval_string("{FILED}"),i,1,fp);
  }
 lr_think_time( 4 );
   fclose(fp);
 lr_end_transaction("DownLoad", LR_AUTO);
 return 0;
}