读取某变量的值

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. vue2.0生命周期详解

    首先上图展 <template> <div id="home"> <p>{{ message }}</p> </div> ...

  2. Android开发之自定义Toast(带详细注释)

    因为工作需求,所以自己研究了自定义Toast,这里做出总结: 在此之前有一点需要提前说明:Toast与其他组件一样,都属于UI界面中的内容,因此在子线程中无法使用Toast弹出提示内容,如果强行在子线 ...

  3. Netty 源码 ChannelHandler(三)概述

    Netty 源码 ChannelHandler(三)概述 Netty 系列目录(https://www.cnblogs.com/binarylei/p/10117436.html) 一.Channel ...

  4. 知名APP(支付宝、微信、花瓣等)首页设计技巧及原型实例讲解

    APP首页设计对APP自身来说是至关重要的,一款优秀的APP产品,其首页设计不仅需要清晰的展示产品核心功能,给用户创造良好的用户体验,而且还需要展示公司的品牌形象,提升在用户心中的品牌认知度.今天,就 ...

  5. .net中反射技术的应用

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Ref ...

  6. Java学习笔记:23种设计模式

    设计模式(Design pattern)的定义: In software engineering, a software design pattern is a general, reusable s ...

  7. 使用yarn 安装 Vue-DevTools

    1. 从 github 下载 vuejs/vue-devtools https://github.com/vuejs/vue-devtools/archive/dev.zip 2.安装yarn 及 编 ...

  8. 【转载】 Jointwave零延时视频传输for FPGA/ASIC进入军工领域

    半导体知识产权H.264/H.265 硅IP核供应商Jointwave公司的发布了一系列视频编解码RTL IP核,已经成功应用于军事工业领域的指挥作战,无人机UAV控制,航空和航天摄像机,视频记录黑匣 ...

  9. 【WebService】WebService之CXF的拦截器(五)

    CXF拦截器介绍 CXF拦截器是功能的主要实现单元,也是主要的扩展点,可以在不对核心模块进行修改的情况下,动态添加功能.当服务被调用时,会经过多个拦截器链(Interceptor Chain)处理,拦 ...

  10. 技术课堂】如何管理MongoDB数据库?