Action()
{
int tag ;
web_reg_save_param("usersession",
"LB=name=userSession value=",
"RB=>",
"ORD=1",
LAST);
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=../favicon.ico", "Referer=", ENDITEM,
LAST);
/*
web_submit_form("login.pl",
"Snapshot=t2.inf",
ITEMDATA,
"Name=username", "Value=xgl", ENDITEM,
"Name=password", "Value=123", ENDITEM,
"Name=login.x", "Value=49", ENDITEM,
"Name=login.y", "Value=9", ENDITEM,
LAST);
*/
tag = web_reg_find("Search=ALL","Text=Welcome", "SaveCount=Welcome_Count", LAST );
web_custom_request("login.pl",
"Method=POST",
"URL=http://127.0.0.1:1080/WebTours/login.pl",
"Body=userSession={usersession}&username={username}&password=123&JSFormSubmit=off&login.x=49&login.y=9",
// "Body=userSession=116796.626407452zAAHHczptHAiDDDDDzAtzpDfiicf&username=xgl&password=123&JSFormSubmit=off&login.x=49&login.y=9",
LAST);
// userSession=116796.626407452zAAHHczptHAiDDDDDzAtzpDfiicf&username=xgl&password=123&JSFormSubmit=off&login.x=49&login.y=9
if (tag == 0) {
lr_output_message("login sucessful %s", lr_eval_string("{username}"));
}
else
{
lr_output_message("login failed %s", lr_eval_string("{username}"));
}
if (atoi(lr_eval_string("{Welcome_Count}")) > 0){
lr_output_message("%s Log on successful.",lr_eval_string ( "{username}" ));
}
else{
lr_error_message("%s Log on failed.",lr_eval_string ( "{username}" ));
return(0);
}
web_image("SignOff Button",
"Alt=SignOff Button",
"Snapshot=t3.inf",
LAST);
return 0;
}
web_custom_request 例子
最新推荐文章于 2019-09-03 10:46:37 发布