kepware http接口 OCaml
读取某变量的值
open Cohttp_lwt_unix
open Cohttp
open Lwt let uri = Uri.of_string "http://127.0.0.1:39321/iotgateway/read?ids=Channel1.Device1.tag1,Channel1.Device1.tag2" in
let headers = Header.init ()
|> fun h -> Header.add h "Connection" "keep-alive"
|> fun h -> Header.add h "Cache-Control" "max-age=0"
|> fun h -> Header.add h "Upgrade-Insecure-Requests" ""
|> fun h -> Header.add h "User-Agent" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36"
|> fun h -> Header.add h "Accept" "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
|> fun h -> Header.add h "Accept-Encoding" "gzip, deflate, br"
|> fun h -> Header.add h "Accept-Language" "zh-CN,zh;q=0.9"
|> fun h -> Header.add h "cache-control" "no-cache"
in Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
列出所有变量
open Cohttp_lwt_unix
open Cohttp
open Lwt let uri = Uri.of_string "http://127.0.0.1:39321/iotgateway/browse" in
let headers = Header.init ()
|> fun h -> Header.add h "Connection" "keep-alive"
|> fun h -> Header.add h "Cache-Control" "max-age=0"
|> fun h -> Header.add h "Upgrade-Insecure-Requests" ""
|> fun h -> Header.add h "User-Agent" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36"
|> fun h -> Header.add h "Accept" "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
|> fun h -> Header.add h "Accept-Encoding" "gzip, deflate, br"
|> fun h -> Header.add h "Accept-Language" "zh-CN,zh;q=0.9"
|> fun h -> Header.add h "cache-control" "no-cache"
in Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
kepware http接口 OCaml的更多相关文章
- kepware http接口 swift
读取某变量的值 import Foundation let headers = [ "Connection": "keep-alive", "Cach ...
- kepware http接口 c语言 ruby
读取某变量的值 require 'uri' require 'net/http' url = URI("http://127.0.0.1:39321/iotgateway/read?ids= ...
- kepware http接口 GO语言开发
读取某变量的值 package main import ( "fmt" "net/http" "io/ioutil" ) func main ...
- kepware http接口 php
读取某变量的值(HttpRequest <?php $request = new HttpRequest(); $request->setUrl('http://127.0.0.1:393 ...
- kepware http接口 c语言 python
读取某变量的值(http.client import http.client conn = http.client.HTTPConnection("127,0,0,1") head ...
- kepware http接口 Objective-C开发
读取某变量的值(NSURL #import <Foundation/Foundation.h> NSDictionary *headers = @{ @"Connection&q ...
- kepware http接口 nodejs开发
读取某变量的值(native var http = require("http"); var options = { "method": "GET&q ...
- kepware http接口 javascript开发
读取某变量的值(jquery var settings = { "async": true, "crossDomain": true, "url&qu ...
- kepware http接口 java语言开发
读取某变量的值(OK HTTP OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .u ...
随机推荐
- 引入flash
调用代码 <div class="media"> <object class="main_video_box" classid="c ...
- django os.environ慎用setdefault操作环境变量!
在绝大多数情况下,如果需要在程序运行过程中设置环境变量,使用os.environ.setdefault函数是没有任何问题的,但是有两种场景下setdefault会造成意外的问题,需要慎用: 如果程序执 ...
- Vue 1.0 和 2.0 执行顺序
// Vue 生命周期 // Vue 1.0 // 执行步骤:选项/生命周期钩子 // 1 init // 2 created // 3 beforeCompile // 4 compiled // ...
- Oracle_PL/SQL(10) 定时器job
定时器job1.定义 定时器指在特定的时间执行特定的操作. 可以多次执行.说明:特定的操作:指一个完成特定功能的存储过程.多次执行:指可以每分钟.每小时.每天.每周.每月.每季度.每年等周期性的运行. ...
- 将文件中的内容读取到map中,并排除不需要的关键字然后输出
- hdu 1010(DFS) 骨头的诱惑
http://acm.hdu.edu.cn/showproblem.php?pid=1010 题目大意从S出发,问能否在时间t的时候到达终点D,X为障碍 需要注意的是要恰好在t时刻到达,而不是在t时间 ...
- iOS.UI.UIWindow
UIWindow 1. UIWindow 2. UIWindow的使用场景 2.1 额外添加的Window需要手动进行旋转 最近有遇到一个UIWindow的使用场景:在ApplicationDeleg ...
- iOS.C
iOS开发中C语言的应用: 1. NS_ENUM & NS_OPTIONS http://nshipster.com/ns_enum-ns_options/
- POJ 3169.Layout 最短路
Layout Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11612 Accepted: 5550 Descripti ...
- 关于 Web Api 2 认证与授权
认证与授权 认证与授权,Authentication and Authorize,这个是两个不同的事.认证是对访问身份进行确认,如验证用户名和密码,而授权是在认证之后,判断是否具有权限进行某操作,如 ...