读取某变量的值

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. L1-006 连续因子(20)(思路+测试点分析)

    L1-006 连续因子(20 分) 一个正整数 N 的因子中可能存在若干连续的数字.例如 630 可以分解为 3×5×6×7,其中 5.6.7 就是 3 个连续的数字.给定任一正整数 N,要求编写程序 ...

  2. hdu (欧拉函数+容斥原理) GCD

    题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1695 看了别人的方法才会做 参考博客http://blog.csdn.net/shiren_Bod/ar ...

  3. 数据存储(直接写入、NSUserDefaults、NSkeyedArchiver)

    ios中常用文件存取的方法有: 1.直接写文件的方式,可以存储的对象有NSString.NSArray.NSDictionary.NSData.NSNumber,数据全部存放在一个属性列表文件(*.p ...

  4. 201621123008 《Java程序设计》 第11周学习总结

    1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结多线程相关内容. 2. 书面作业 本次PTA作业题集多线程 1. 源代码阅读:多线程程序BounceThread 1.1 BallR ...

  5. virualbox问题

    出不来64位虚拟系统 bios设置虚拟化可用 2.创建虚拟机 启动不了 提示 不能打开一个... 安装exten 扩张包 3.设备 -- 安装增强功能... 分辨率  设置成功

  6. Why Linux Doesn’t Need Defragmenting

    If you’re a Linux user, you’ve probably heard that you don’t need to defragment your Linux file syst ...

  7. [Jmeter] Run Command to generate a specific listener’s chart report

    Run Command to generate a specific listener’s chart report: Download cmdrunner-2.0.jar : https://jme ...

  8. [RF] 安装好Robot Framework之后怎样让启动的界面后面不带命令行窗口,且图片以机器人显示

    安装好Robot Framework之后,通过 C:\Python27\Scripts\ride.py 启动时会带上一个命令行窗口: 怎样让启动的界面后面不带这个命令行窗口,且图片以机器人显示? 方法 ...

  9. ERROR - abandon connection, open stackTrace

    项目采用的是阿里巴巴的druid连接池,配置文件中有个removeAbandoned的配置(意义是某个连接如果超过设置的连接活动时间的话,连接会被强制关掉),但是因为爬虫中某些连接会长时间处于活动状态 ...

  10. STL基础3:map

    #include <iostream> #include <map> #include <string> using namespace std; #define ...