模拟APP发送请求给Cloud,
一般都是用户登录后。cloud会返回登录成功的消息并且返回一个cookie给app,
app下次要做一些例如设置名称之类的工作,在请求消息里面会携带返回的cookie,而且cloud也会校验这个cookie
1、第一次请求登录,获取cookie,
2、使用第一次请求获取的cookie进行第二次请求
一般都是用户登录后。cloud会返回登录成功的消息并且返回一个cookie给app,
app下次要做一些例如设置名称之类的工作,在请求消息里面会携带返回的cookie,而且cloud也会校验这个cookie
1、第一次请求登录,获取cookie,
2、使用第一次请求获取的cookie进行第二次请求
Action()
{
web_reg_save_param("par1",
"LB=auth_key":"",
"RB="",
LAST);
web_reg_save_param("par3",
"LB=Set-Cookie: ",
"RB=;",
"ORD=2",
LAST);
web_reg_save_param("par4",
"LB=Set-Cookie: ",
"RB=;",
"ORD=3",
LAST);
web_custom_request("login",
"URL=http://192.168.1.102/api/user/login",
"Method=POST",
"Resource=0",
"Referer=",
"mode=HTTP",
"Body=email=t993@163.com&password=8c2b2f9cd3431be8a7bf64a33e81b371",
LAST);
lr_message ("par1:%s", lr_eval_string("{par1}"));
lr_message ("par3:%s", lr_eval_string("{par3}"));
lr_message ("par4:%s", lr_eval_string("{par4}"));
return 0;
}
Action2()
{
web_cleanup_cookies();
web_add_header("cookie",
"{par3};{par4};{par1}");
web_custom_request("info",
"URL=http://192.168.1.102/api/app/set/device",
"Method=POST",
"Resource=0",
"Referer=",
"mode=HTTP",
"Body=camid=4026aabz&auth_key={par1}",
LAST);
return 0;
}
传json数据时引号前加转义字符
{
web_reg_save_param("par1",
"LB=auth_key":"",
"RB="",
LAST);
web_reg_save_param("par3",
"LB=Set-Cookie: ",
"RB=;",
"ORD=2",
LAST);
web_reg_save_param("par4",
"LB=Set-Cookie: ",
"RB=;",
"ORD=3",
LAST);
web_custom_request("login",
"URL=http://192.168.1.102/api/user/login",
"Method=POST",
"Resource=0",
"Referer=",
"mode=HTTP",
"Body=email=t993@163.com&password=8c2b2f9cd3431be8a7bf64a33e81b371",
LAST);
lr_message ("par1:%s", lr_eval_string("{par1}"));
lr_message ("par3:%s", lr_eval_string("{par3}"));
lr_message ("par4:%s", lr_eval_string("{par4}"));
return 0;
}
Action2()
{
web_cleanup_cookies();
web_add_header("cookie",
"{par3};{par4};{par1}");
web_custom_request("info",
"URL=http://192.168.1.102/api/app/set/device",
"Method=POST",
"Resource=0",
"Referer=",
"mode=HTTP",
"Body=camid=4026aabz&auth_key={par1}",
LAST);
return 0;
}
传json数据时引号前加转义字符
"Name=input","Value={"mobile":"15280288286","password":"6f96c57e306923c7"}",ENDITEM,