您的位置:首页 > Web前端 > JavaScript

提交json串格式的POST请求

2016-01-15 14:19 453 查看
提交json串格式的POST请求

Action()

{

web_reg_save_param("retCode",

"LB=retCode\":\"",

"RB=\"",

"NotFound=WARNING",

LAST);

lr_start_transaction("test");

web_add_header("Content-Type" ,"application/json");

web_custom_request("test",

"URL=http://127.0.0.1/test ",

"Method=POST",

"Resource=0",

"Referer=",

"Mode=HTTP",

"EncType=application/json; charset=UTF-8",

"RecContentType=application/json",

"Body={\"channelNo\":\"{channelNo}\",\" phoneno \":12345678900,\"createdTime\":\"{createdTime}\"}",

LAST);

if (!strcmp(lr_eval_string("{retCode}"),"000000"))

{

lr_output_message("Successfull, retcode is:%s", lr_eval_string("{retCode}"));

lr_end_transaction("test ", LR_PASS);

}

else{

lr_error_message("Failed, retcode is:%s", lr_eval_string("{retCode}"));

lr_end_transaction("test ", LR_FAIL);

}

return 0;

}

在编写json串时,注意保证body内容的正确性,字符串必须在\" \"之间,参数名称与参数值之间是:,参数与参数之间用逗号分隔。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: