sunyluo 发表于 2017-8-21 10:47:15

请问如何用web_add_cookie模拟登录状态

学习LoadRunner,教程中有一个例子是在phpwind中进行发帖,不想每次都进行登录操作,看网上说可以利用web_add_cookie模拟登录状态,从而避开登录操作,不知道应该怎么做,整体录制的代码如下:
Action()
{

    web_add_cookie("3b937_lastpos=index; DOMAIN=172.16.16.80");

    web_add_cookie("3b937_ol_offset=98; DOMAIN=172.16.16.80");

    web_add_cookie("3b937_ipstate=1502845269; DOMAIN=172.16.16.80");

    web_add_cookie("3b937_cloudClientUid=5253575; DOMAIN=172.16.16.80");

    web_add_cookie("3b937_ck_info=%2F%09; DOMAIN=172.16.16.80");

    web_add_cookie("3b937_lastvisit=196%091502845496%09%2Fphpwind%2Findex.php%3Fmbbs; DOMAIN=172.16.16.80");

    web_add_cookie("3b937_jobpop=1; DOMAIN=172.16.16.80");

    web_add_cookie("3b937_ci=index%091502845496%09%09; DOMAIN=172.16.16.80");

    web_url("index.php",
      "URL=http://172.16.16.80/phpwind/index.php",
      "TargetFrame=",
      "Resource=0",
      "RecContentType=text/html",
      "Referer=",
      "Snapshot=t2.inf",
      "Mode=HTML",
      EXTRARES,
      。。
      LAST);

    lr_think_time(19);

    web_submit_data("login.php",
      "Action=http://172.16.16.80/phpwind/login.php?nowtime=1502956686136&verify=17a55952738950d7",
      "Method=POST",
      "TargetFrame=",
      "RecContentType=text/xml",
      "Referer=http://172.16.16.80/phpwind/index.php",
      "Snapshot=t3.inf",
      "Mode=HTML",
      ITEMDATA,
      "Name=jumpurl", "Value=http://172.16.16.80/phpwind/index.php", ENDITEM,
      "Name=step", "Value=2", ENDITEM,
      "Name=ajax", "Value=1", ENDITEM,
      "Name=verify", "Value=17a55952738950d7", ENDITEM,
      "Name=pwuser", "Value=suny1", ENDITEM,
      "Name=pwpwd", "Value=123456", ENDITEM,
      "Name=lgt", "Value=0", ENDITEM,
      LAST);

    web_url("index.php_2",
      "URL=http://172.16.16.80/phpwind/index.php",
      "TargetFrame=",
      "Resource=0",
      "RecContentType=text/html",
      "Referer=",
      "Snapshot=t4.inf",
      "Mode=HTML",
      EXTRARES,
       ..
      LAST);
    web_url("鏂版墜鏉垮潡",
      "URL=http://172.16.16.80/phpwind/thread.php?fid=3",
      "TargetFrame=",
      "Resource=0",
      "RecContentType=text/html",
      "Referer=http://172.16.16.80/phpwind/index.php",
      "Snapshot=t5.inf",
      "Mode=HTML",
      EXTRARES,
..
      LAST);

    web_url("鍙戝笘",
      "URL=http://172.16.16.80/phpwind/post.php?fid=3",
      "TargetFrame=",
      "Resource=0",
      "RecContentType=text/html",
      "Referer=http://172.16.16.80/phpwind/thread.php?fid=3",
      "Snapshot=t6.inf",
      "Mode=HTML",
      EXTRARES,
      "Url=js/breeze/core/native.js?v=1.0.1109", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=images/pwicon/ms_tips.png", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=images/pwicon/at.png", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=images/input_down.png", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=images/post/c_editor/w_edit_but.png", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=js/breeze/editor/editor.js?v=1.0.1109", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=js/breeze/core/dom.js?v=1.0.1109", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=js/breeze/core/event.js?v=1.0.1109", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=js/breeze/editor/ubb.js?v=1.0.1109", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=js/breeze/editor/style/full.png", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=js/breeze/editor/style/B_ico.png", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=js/breeze/app/at.js?v=1.0.1109", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      "Url=js/breeze/util/localStorage.js?v=1.0.1109", "Referer=http://172.16.16.80/phpwind/post.php?fid=3", ENDITEM,
      LAST);
    web_submit_data("post.php",
      "Action=http://172.16.16.80/phpwind/post.php?fid=3&nowtime=1502956728309&verify=79cc78dac563ce85",
      "Method=POST",
      "EncType=multipart/form-data",
      "TargetFrame=",
      "RecContentType=text/xml",
      "Referer=http://172.16.16.80/phpwind/post.php?fid=3",
      "Snapshot=t7.inf",
      "Mode=HTML",
      ITEMDATA,
      "Name=magicname", "Value=", ENDITEM,
      "Name=magicid", "Value=", ENDITEM,
      "Name=verify", "Value=79cc78dac563ce85", ENDITEM,
      "Name=cyid", "Value=0", ENDITEM,
      "Name=ajax", "Value=1", ENDITEM,
      "Name=iscontinue", "Value=0", ENDITEM,
      "Name=atc_title", "Value=this is the first", ENDITEM,
      "Name=atc_content", "Value=first", ENDITEM,
      "Name=usernames", "Value=", ENDITEM,
      "Name=atc_tags", "Value=", ENDITEM,
      "Name=atc_money", "Value=0", ENDITEM,
      "Name=atc_rvrc", "Value=0", ENDITEM,
      "Name=replyreward", "Value=", ENDITEM,
      "Name=replyreward", "Value=", ENDITEM,
      "Name=replyreward", "Value=1", ENDITEM,
      "Name=replyreward", "Value=10", ENDITEM,
      "Name=atc_usesign", "Value=1", ENDITEM,
      "Name=atc_autourl", "Value=1", ENDITEM,
      "Name=atc_convert", "Value=1", ENDITEM,
      "Name=step", "Value=2", ENDITEM,
      "Name=pid", "Value=", ENDITEM,
      "Name=action", "Value=new", ENDITEM,
      "Name=fid", "Value=3", ENDITEM,
      "Name=tid", "Value=0", ENDITEM,
      "Name=article", "Value=0", ENDITEM,
      "Name=special", "Value=0", ENDITEM,
      "Name=_hexie", "Value=ac7f464468d3a8bc", ENDITEM,
      LAST);

    web_add_cookie("_ac_96fd7d51=1; DOMAIN=172.16.16.80");

    web_url("read.php",
      "URL=http://172.16.16.80/phpwind/read.php?tid=1&ds=1",
      "TargetFrame=",
      "Resource=0",
      "RecContentType=text/html",
      "Referer=",
      "Snapshot=t8.inf",
      "Mode=HTML",
      EXTRARES,
      "Url=images/pwicon/read_prev.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/wind/reply.png?101129", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/pwicon/add_home.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/online.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/pwicon/add_pro.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/pwicon/add_fri.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/wind/read/yin.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/wind/read/userOper.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/wind/breadEm.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/pwicon/shareAll.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/pre.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/5.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/1.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/2.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/3.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/4.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/6.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/7.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/8.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/9.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/12.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/13.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/10.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/14.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/smile/default/11.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/blank.gif", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/search/pImg.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/post/fp_editor_bg.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=u/images/next.cur", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=u/images/pre.cur", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      "Url=images/search/pImg_close.png", "Referer=http://172.16.16.80/phpwind/read.php?tid=1&ds=1", ENDITEM,
      LAST);

    return 0;
}


Fighting-ing 发表于 2017-8-22 13:52:55

看下这个吧,可能会帮助你理解http://blog.csdn.net/rital/article/details/4195776

sunyluo 发表于 2017-8-23 08:59:45

Fighting-ing 发表于 2017-8-22 13:52
看下这个吧,可能会帮助你理解http://blog.csdn.net/rital/article/details/4195776

恩恩 谢谢
页: [1]
查看完整版本: 请问如何用web_add_cookie模拟登录状态