普通模式
普通编程模式,可以使用下面的 http方法,支持http.get/post ,还支持REST API相关操作,函数功能如下:
| 函数 | 参数 | HTTP 方法 | 数据格式 | 用途 |
|---|---|---|---|---|
http.get | (url) | GET | — | 查询资源 |
http.post | (url, data) | POST | application/x-www-form-urlencoded | 提交表单数据 |
http.postJSON | (url, json) | POST | application/json | 创建资源 |
http.put | (url, json) | PUT | application/json | 全量替换资源 |
http.patch | (url, json) | PATCH | application/json | 部分更新资源 |
http.delete | (url) | DELETE | — | 删除资源 |
- 参数:
url: string
json: string- 返回值:
html/json:string
json字符串用 `[[ ... ]]` 包起来.例子:
base="http://www.simfas.cn/app/rest/post_json/"
http.post_json(base, `{"name":"sensor_A","value":36.5}`);
专家模式,请看下面
如果上述内置的函数不能满足要求,请用专家模式,按下面方法操作。
中控模拟浏览器http.post
中控除了可以 http.get编程,还可以进行http.post编程,可以使用中控模拟网页浏览器.
使用方法
中控代码市场 搜索 http post ,导入中控,专家模式.

代码分析

可选参数
http.Content_Type
http.User_Agent
http.Accept
可以使用Postman先调试
到中控编程前,可以使用Postman进行调试,测试好网址和功能以及参数设置,特别是http.Content_Type,然后再到中控编程.
其它提示
可以使用socket调试工具,打开tcp 服务器,使用Postman和中控分别向电脑的调试工具发数据.
最后一次更新于2026-05-16



0 条评论