Get请求:
web_reg_save_param("ResponseBody", "LB=", "RB=", "Search=Body", LAST);
lr_start_transaction("Ts_GetAttentionList");
web_reg_find("Search=Body",//这里说明在Body的范围内查找
"SaveCount=ret_Count",//这里表示把返回值的个数放在变量ret_Count里
"Text=UserId",//这里表示查找的内容是“t”
LAST);
web_url("Ts_GetAttentionList",
"Resource=1",
"RecContentType=application/json",
"Referer=",
LAST);
if (atoi(lr_eval_string("{ret_Count}")) >=1){//这里判断检查到的个数
lr_end_transaction("Ts_GetAttentionList", LR_PASS);
lr_convert_string_encoding(lr_eval_string("{ResponseBody}"),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"ResponseBody");
lr_log_message("# 响应内容体:
%s", lr_eval_string("{ResponseBody}"));
lr_log_message("# 响应内容体:
%s", lr_eval_string("{userid}"));
//lr_output_message("# 响应内容体:
%s", lr_eval_string("{ResponseBody}"));
//lr_output_message("# 响应内容体:
%s", lr_eval_string("{userid}"));
}
else{
lr_end_transaction("Ts_GetAttentionList", LR_FAIL);
lr_convert_string_encoding(lr_eval_string("{ResponseBody}"),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"ResponseBody");
lr_log_message("# 响应内容体:
%s", lr_eval_string("{ResponseBody}"));
// lr_log_message"# 响应内容体:
%s", lr_eval_string("{userid}"));
}
POST请求:
web_reg_save_param("ResponseBody", "LB=", "RB=", "Search=Body", LAST);
web_reg_find("Search=Body",//这里说明在Body的范围内查找
"SaveCount=ret_Count",//这里表示把返回值的个数放在变量ret_Count里
"Text=ok",//这里表示查找的内容是“t”
LAST);
lr_start_transaction("AddTaskItem");
web_custom_request("AddTaskItem",
"Method=POST",
"RecContentType=application/json",
"Referer=",
"Mode=HTTP",
"EncType=application/json; charset=UTF-8",
"Body={"TaskName":"DemoTask","BizID":"DemoTaskLR{Num}","BookTime":"2016-01-05 17:51:50","CallbackParam":{"Request":"Test","NeedOK":true}}",
LAST);
if (atoi(lr_eval_string("{ret_Count}"))>=1){//这里判断检查到的个数
lr_end_transaction("AddTaskItem", LR_PASS);
lr_convert_string_encoding(lr_eval_string("{ResponseBody}"),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"ResponseBody");
lr_output_message("# 响应内容体:
%s", lr_eval_string("{ResponseBody}"));
}
else{
lr_end_transaction("AddTaskItem", LR_FAIL);
lr_convert_string_encoding(lr_eval_string("{ResponseBody}"),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"ResponseBody");
lr_output_message("# 响应内容体:
%s", lr_eval_string("{ResponseBody}"));
}
return 0;