web_submit_data和web_custom_request的比较

使用web_submit_data()函数的POST方法提交表单数据:

Action()

{

      web_submit_data("order",

      "Action=http://192.168.52.123/api/order/",

      "Method=POST",

      "TargetFrame=",

      "RecContentType=text/html",

      "Mode=HTML",

 

      ITEMDATA,

      "Name=price", "Value={NewParam}", ENDITEM,

      "Name=amount", "Value=100", ENDITEM,

      "Name=action", "Value=0", ENDITEM,

      "Name=user", "Value={NewParam_1}", ENDITEM,

      "Name=stock", "Value={NewParam_2}", ENDITEM,

       LAST);

       return0;

}




用web_custom_request()函数实现提交数据:


Action()

 //加个头文件,用来说明使用的方法

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

   web_custom_request("HKS",

                       "URL=http://192.168.50.17:8080/commissions/bench_5/1/HKS",

                       "Method=POST",

                       "Resource=0",

                        "RecContentType=application/json",

                      "Referer=",                     

                      "Body={\"accountId\":\"HKS_1\",\"commission_amount\":1000.00,\"commission_price\":95.000,\"commission_type\":\"0\",\"embed\":1,\"stock_code\":\"00001\",\"stock_type\":\"0\",\"uuid\":\"bench_5\"}",

                      "TargetFrame=",

                       LAST);

       //判断页面返回正确与否

       if(web_get_int_property(HTTP_INFO_RETURN_CODE)==201)  //开发确认此接口返回值为201

              lr_output_message("OK!!");

       else

              lr_error_message("Fail!!");

       return0;

}




你可能感兴趣的:(html,Web,header,user,action,output)