zoukankan      html  css  js  c++  java
  • 提交json串格式的POST请求

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

  • 相关阅读:
    Python-内置函数
    Python-匿名函数
    Python-函数递归-二分法
    Python-函数递归
    Day4-函数
    CSS-定位
    CSS-文本属性,文字属性
    CSS-浮动
    CSS-盒模型
    CSS-继承和层叠
  • 原文地址:https://www.cnblogs.com/TestWorld/p/5133188.html
Copyright © 2011-2022 走看看