定义:注册一个请求,将请求的动态数据信息保存到一个参数
**函数形式:**web_reg_save_param( const char *ParamName, , LAST )
基本信息:
1、web_reg_save_param注册一个请求,从下一个操作功能,服务器返回信息中查找并保存文本字符串,并保存在服务器响应下一个操作功能。
2、当脚本中启用了“发生错误继续执行(Contiinue on Error)”时,即使Notfound被设置为“Error”,在找不到边界时,脚本仍将会继续执行,但会将错误消息写入日志文件
3、在边界之后指定“/IC”,即LB/IC、RB/IC,则表示忽略边界参数的大小写;在边界之后指定“/BIN”,即RB/BIN、RB/BIN,则表示为二进制数据
4、属性值不区分大小写,如”Search=all”
示例1:保存简单的文本字符串
该示例中,web_reg_save_param将保存一个值,该值来自web_submit_form调用后的服务器响应信息,在后续的另一个web_submit_form中被使用。
在机票示例
程序中,web_submit_form调用返回的服务器信息中包含以下单选项:
Action()
{
lr_save_string("192.168.1.99:8080","ip");//测试服务器
//lr_save_string("192.168.1.99:8080","ip");//非测试服务器
lr_start_transaction("首页");///
web_url("index",
"URL=http://{ip}/abc_e1/draw/index?test=1",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
EXTRARES,
LAST);
lr_end_transaction("首页",LR_AUTO);
lr_start_transaction("登录");///
web_submit_data("userLoginJsonP",
"Action=http://{ip}/abc_e1/draw/userLoginJsonP",
"Method=POST",
"TargetFrame=",
"RecContentType=text/plain",
"Referer=",
"Mode=HTML",
ITEMDATA,
"Name=name","Value=name-liuweijing",ENDITEM,
"Name=mobile","Value=13269283455",ENDITEM,//
"Name=code","Value=123456",ENDITEM,
LAST);
lr_end_transaction("登录", LR_AUTO);
lr_start_transaction("跳到农行支付页面");//
web_submit_data("payJsonP",
"Action=http://{ip}/abc_e1/draw/payJsonP",
"Method=POST",
"TargetFrame=",
"RecContentType=text/plain",
"Referer=",
"Mode=HTML",
ITEMDATA,
"Name=token","Value=back",ENDITEM,
LAST);
lr_end_transaction("跳到农行支付页面", LR_AUTO);
lr_start_transaction("支付信息查询");///
web_reg_save_param("orderId",
"LB=\"orderId\":\"",
"RB=\",\"token\"",
"Ord=1",
"Notfound=empty",
"Search=Body",LAST);
web_submit_data("queryPayJsonP",
"Action=http://{ip}/abc_e1/draw/queryPayJsonP",
"Method=POST",
"TargetFrame=",
"RecContentType=text/plain",
"Referer=",
"Mode=HTML",
ITEMDATA,
"Name=token","Value=back",ENDITEM,
LAST);
lr_output_message(lr_eval_string("获取参数值的字符串表示:{orderId}"));
lr_end_transaction("支付信息查询", LR_AUTO);
//
//
lr_start_transaction("支付抽奖");
web_submit_data("doPayDrawJsonP",
"Action=http://{ip}/abc_e1/draw/doPayDrawJsonP",
"Method=POST",
"TargetFrame=",
"RecContentType=text/plain",
"Referer=",
"Mode=HTML",
ITEMDATA,
"Name=token","Value=back",ENDITEM,
"Name=orderId","Value={orderId}",ENDITEM,
LAST);
lr_end_transaction("支付抽奖", LR_AUTO);
//
return 0;
}
empty
------------------------
<tr bgcolor=#66cccc><th>Flight<th>Departure time<th>Cost
<tr bgcolor=#66CCff><td align=center><input type = radio name=outboundFlight value=230;378;11/20/2003 checked >Blue Sky Air 230<td align=center>8am<td align=center>$ 378
<tr bgcolor=#eeeeee><td align=center><input type = radio name=outboundFlight value=231;337;11/20/2003>Blue Sky Air 231<td align=center>1pm<td align=center>$ 337