Action()
{
/*
测试QQ是否在线的功能接口
输入参数:QQ号码 String,默认QQ号码:8698053。
返回数据:String,Y = 在线;N = 离线;E = QQ号码错误;A = 商业用户验证失败;V = 免费用户超过数量
*/
//1、获取检查get请求的是否成功
web_reg_save_param("getResult",
"LB=HTTP/1.1 ",
"RB= OK",
LAST);
//2、获取get请求结果的标志
web_reg_save_param("getStatus",
"LB=<string xmlns="http://WebXml.com.cn/">",
"RB=</string>",
LAST);
//3、停顿2秒
lr_think_time(2);
//4、开始get请求
lr_start_transaction("get请求");
//5、提交get请求
web_url("get请求",
"URL=http://ws.webxml.com.cn/webservices/qqOnlineWebService.asmx/qqCheckOnline?qqCode={qqNumber}",
"TargetFrame=",
"Resource=0",
"RecContentType=text/xml;charset=utf-8",
"Referer=",
"Snapshot=t7.inf",
"Mode=HTML",
LAST);
//6、判断事物是否成功
if(atoi(lr_eval_string("{getResult}")) == 200)
{
//结束get请求
lr_end_transaction("get请求", LR_PASS);
lr_output_message("get请求成功");
}
else
{
//结束post请求
lr_end_transaction("get请求", LR_FAIL);
lr_output_message("get请求失败");
}
//1、获取检查post请求是否成功
web_reg_save_param("postResult",
"LB=HTTP/1.1 ",
"RB= OK",
LAST);
//2、获取post请求结果的标志
web_reg_save_param("postStatus",
"LB=<string xmlns="http://WebXml.com.cn/">",
"RB=</string>",
LAST);
//3、停顿2秒
lr_think_time(2);
//web_add_auto_header("Content-Type","application/x-www-form-urlencoded");
web_set_max_html_param_len("256");
//4、开始post请求
lr_start_transaction("post请求");
//5、提交post请求
web_submit_data("post请求",
"Action=http://ws.webxml.com.cn/webservices/qqOnlineWebService.asmx/qqCheckOnline",
"Method=POST",
"TargetFrame=",
"RecContentType=text/xml;charset=utf-8",
"Referer=",
"Snapshot=t12.inf",
"Mode=HTML",
ITEMDATA,
"Name=qqCode", "Value={qqNumber}", ENDITEM,
LAST);
//6、判断post请求事物是否成功
if(atoi(lr_eval_string("{postResult}")) ==200)
{
//结束post请求
lr_end_transaction("post请求", LR_PASS);
lr_output_message("post请求成功");
}
else
{
//结束post请求
lr_end_transaction("post请求", LR_FAIL);
lr_output_message("post请求失败");
}
return 0;
}