kepware http接口 nodejs开发
读取某变量的值(native
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"127",
"0",
"0",
"1"
],
"port": "39321",
"path": [
"iotgateway",
"read"
],
"headers": {
"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
"cache-control": "no-cache",
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
读取某变量的值(request
var request = require("request");
var options = { method: 'GET',
url: 'http://127.0.0.1:39321/iotgateway/read',
qs: { ids: [ 'Channel1.Device1.tag1', 'Channel1.Device1.tag2' ] },
headers:
{'cache-control': 'no-cache',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36',
'Upgrade-Insecure-Requests': '1',
'Cache-Control': 'max-age=0',
Connection: 'keep-alive' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
读取某变量的值(unirest
var unirest = require("unirest");
var req = unirest("GET", "http://127.0.0.1:39321/iotgateway/read");
req.query({
"ids": [
"Channel1.Device1.tag1",
"Channel1.Device1.tag2"
]
});
req.headers({"cache-control": "no-cache",
"Accept-Language": "zh-CN,zh;q=0.9",
"Accept-Encoding": "gzip, deflate, br",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
"Upgrade-Insecure-Requests": "1",
"Cache-Control": "max-age=0",
"Connection": "keep-alive"
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
浏览全部变量(native
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"127",
"0",
"0",
"1"
],
"port": "39321",
"path": [
"iotgateway",
"browse"
],
"headers": {
"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
"cache-control": "no-cache",
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
浏览全部变量(request
var request = require("request");
var options = { method: 'GET',
url: 'http://127.0.0.1:39321/iotgateway/browse',
headers:
{ 'cache-control': 'no-cache',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36',
'Upgrade-Insecure-Requests': '1',
'Cache-Control': 'max-age=0',
Connection: 'keep-alive' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
浏览全部变量(unirest
var unirest = require("unirest");
var req = unirest("GET", "http://127.0.0.1:39321/iotgateway/browse");
req.headers({"cache-control": "no-cache",
"Accept-Language": "zh-CN,zh;q=0.9",
"Accept-Encoding": "gzip, deflate, br",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
"Upgrade-Insecure-Requests": "1",
"Cache-Control": "max-age=0",
"Connection": "keep-alive"
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
kepware http接口 nodejs开发的更多相关文章
- kepware http接口 Objective-C开发
读取某变量的值(NSURL #import <Foundation/Foundation.h> NSDictionary *headers = @{ @"Connection&q ...
- kepware http接口 javascript开发
读取某变量的值(jquery var settings = { "async": true, "crossDomain": true, "url&qu ...
- kepware http接口 shell开发
读取某变量的值(wget wget --quiet \ --method GET \ --header 'Connection: keep-alive' \ --header 'Cache-Contr ...
- NodeJs 开发微信公众号(四)微信网页授权
微信的网页授权指的是在微信公众号中访问第三方网页时获取用户地理.个人等信息的权限.对于开发了自己的网页app应用时,获取个人的信息非常重要.上篇博客讲到了注册时可以获取用户的信息,很多人会问为什么还需 ...
- nodejs开发指南读后感
nodejs开发指南读后感 阅读目录 使用nodejs创建http服务器; supervisor的使用及nodejs常见的调式代码命令了解; 了解Node核心模块; ejs模板引擎 Express 理 ...
- Selenium自动化测试,接口自动化测试开发,性能测试从入门到精通
Selenium自动化测试,接口自动化测试开发,性能测试从入门到精通Selenium接口性能自动化测试基础部分:分层自动化思想Slenium介绍Selenium1.0/2.0/3.0Slenium R ...
- Nodejs开发人脸识别系统-教你实现高大上的人工智能
Nodejs开发人脸识别系统-教你实现高大上的人工智能 一.缘起缘生 前段时间有个H5很火,上传个头像就可以显示自己穿军装的样子,无意中看到了一篇帖子叫 全民刷军装背后的AI技术及简单实现 ,里面 ...
- nodejs开发解决方案
1.2. 统一环境 开发环境 nvm nrm nodejs 0.10.38 node-inspector 部署环境 nvm nrm iojs 2.x pm2 nginx 异步流程控制:Promise是 ...
- 《连载 | 物联网框架ServerSuperIO教程》- 12.服务接口的开发,以及与云端双向交互
1.C#跨平台物联网通讯框架ServerSuperIO(SSIO)介绍 <连载 | 物联网框架ServerSuperIO教程>1.4种通讯模式机制. <连载 | 物联网框架Serve ...
随机推荐
- 基于vue的悬浮碰撞窗口(用于打广告的)组件
由于项目需要改写了一个悬浮碰撞弹窗组件 <template> <div class="floatLayer"> <a class="clos ...
- Convert 实现 pdf 和图片格式互转
pdf 转换为图片 (注意:pdf 默认转换的是透明背景,如果转为jpg格式必须添加背景色.-background white -flatten) convert -background white ...
- Can I win LT464
In the "100 game," two players take turns adding, to a running total, any integer from 1.. ...
- jquery查找frameset框架内iframe的元素
老系统还幸存有过时的frameset框架,维护升级工作需要对其内部的iframe中的元素进行相关操作.使用jquery查找子iframe页面内的元素时,总找不到目标元素.后来发现少了contents ...
- python代码检索小引擎
https://www.programcreek.com/python/
- [js]获取网页屏幕可见区域高度
document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.docume ...
- Windows事件日志报表 怎样备份数据库?
- UGUI图集
Editor->Project Settings 下面有sprite packer的模式.Disabled表示不启用它,Enabled For Builds 表示只有打包的时候才会启用它,Alw ...
- unity在一个对象上挂多个一样的脚本怎么获取
使用GetComponents获取,存到一个该类的数组里
- mysql之数据库的介绍和基本的增删改查
一 学前知识 什么叫做静态页面:用户传入内容后,不能处理用户的请求,只能单纯的显示主页面的信息. 什么是负载均衡:通过计算服务器的性能,将客户发送过来的请求指派给某台服务器.一般还要有一个备份的负载均 ...