读取某变量的值

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的更多相关文章

  1. kepware http接口 swift

    读取某变量的值 import Foundation let headers = [ "Connection": "keep-alive", "Cach ...

  2. kepware http接口 c语言 ruby

    读取某变量的值 require 'uri' require 'net/http' url = URI("http://127.0.0.1:39321/iotgateway/read?ids= ...

  3. kepware http接口 GO语言开发

    读取某变量的值 package main import ( "fmt" "net/http" "io/ioutil" ) func main ...

  4. kepware http接口 php

    读取某变量的值(HttpRequest <?php $request = new HttpRequest(); $request->setUrl('http://127.0.0.1:393 ...

  5. kepware http接口 c语言 python

    读取某变量的值(http.client import http.client conn = http.client.HTTPConnection("127,0,0,1") head ...

  6. kepware http接口 Objective-C开发

    读取某变量的值(NSURL #import <Foundation/Foundation.h> NSDictionary *headers = @{ @"Connection&q ...

  7. kepware http接口 nodejs开发

    读取某变量的值(native var http = require("http"); var options = { "method": "GET&q ...

  8. kepware http接口 javascript开发

    读取某变量的值(jquery var settings = { "async": true, "crossDomain": true, "url&qu ...

  9. kepware http接口 java语言开发

    读取某变量的值(OK HTTP OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .u ...

随机推荐

  1. vue-awesome-swiper轮播的使用

    一.安装vue-awesome-swiper npm install vue-awesome-swiper --save 二.引入插件 main.js里面分别引入(记得有些电脑要引入样式) impor ...

  2. JavaScript 字符串用于存储和处理文本

    JavaScript 字符串用于存储和处理文本 var string_value='dasfsdfsd'; 注意:字符串利用索引精确定位取值 var character=string_value[7] ...

  3. springMvc入门--初识springMvc

    springMvc是什么 springmvc是表现层的框架,是一个spring的表现层组件.是整个spring框架的一部分,但是也可以不使用springmvc.跟struts2框架功能类似.其中的mv ...

  4. iserver-数据库型数据源导入后原dataset名称和数据库表名不一致的问题

    一.发现问题 系统中发现某个房屋的分层平面图查询不到 1.去sqlserver空间库中查询发现这个表‘房间_100200T001D001’不存在 2.在工作空间中查询发现是有这个数据集的 二.解决问题 ...

  5. C++中string类

    https://blog.csdn.net/sinat_36184075/article/details/54836053 https://blog.csdn.net/fdqw_sph/article ...

  6. PAT乙级 解题目录

    有些题做得可能比较傻,有好方法,或者有错误还请告诉我,多多指教=.= 思路比较好的题目我都有讲的很详细. 剩下三道题有待优化,等改好了再上传.   标题 题目链接 解题链接 1001 害死人不偿命的( ...

  7. vxlan vs GRE(三层组播和二层组播如何对应起来)

    www.huawei.com/ilink/cnenterprise/download/HW_401028 http://feisky.xyz/sdn/basic/vxlan.html 华为的vxlan ...

  8. c#不同数组之间的转换【转载,消化自动删除】

    c#中从string数组转换到int数组 string[] input = { "1", "2", "3", "4", ...

  9. yii2.0增删改查

    //关闭csrf public $enableCsrfValidation = false; 1.sql语句 //查询 $db=\Yii::$app->db ->createCommand ...

  10. jx9脚本引擎BUG修复

    BUG1:    rc = WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), pOutput, (DWORD)nOutputLen, 0, 0);        修 ...