码迷,mamicode.com
首页 > Web开发 > 详细

提交json串格式的POST请求

时间:2016-01-15 15:58:18      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

提交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内容的正确性,字符串必须在\" \"之间,参数名称与参数值之间是:,参数与参数之间用逗号分隔。

 

提交json串格式的POST请求

标签:

原文地址:http://www.cnblogs.com/TestWorld/p/5133188.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!