kepware http接口 php
读取某变量的值(HttpRequest
<?php $request = new HttpRequest();
$request->setUrl('http://127.0.0.1:39321/iotgateway/read');
$request->setMethod(HTTP_METH_GET); $request->setQueryData(array(
'ids' => array(
'Channel1.Device1.tag1',
'Channel1.Device1.tag2'
)
)); $request->setHeaders(array(
'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'
)); try {
$response = $request->send(); echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
读取某变量的值(pecl_http
<?php $client = new http\Client;
$request = new http\Client\Request; $request->setRequestUrl('http://127.0.0.1:39321/iotgateway/read');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
'ids' => array(
'Channel1.Device1.tag1',
'Channel1.Device1.tag2'
)
))); $request->setHeaders(array(
'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'
)); $client->enqueue($request)->send();
$response = $client->getResponse(); echo $response->getBody();
读取某变量的值(curl
<?php $curl = curl_init(); curl_setopt_array($curl, array(
CURLOPT_PORT => "39321",
CURLOPT_URL => "http://127.0.0.1:39321/iotgateway/read?ids=Channel1.Device1.tag1,Channel1.Device1.tag2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"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: max-age=0",
"Connection: keep-alive",
"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",
"cache-control: no-cache"
),
)); $response = curl_exec($curl);
$err = curl_error($curl); curl_close($curl); if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
kepware http接口 php的更多相关文章
- 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接口 c语言 python
读取某变量的值(http.client import http.client conn = http.client.HTTPConnection("127,0,0,1") head ...
- kepware http接口 OCaml
读取某变量的值 open Cohttp_lwt_unix open Cohttp open Lwt let uri = Uri.of_string "http://127.0.0.1:393 ...
- 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 ...
随机推荐
- 谷歌开发的draco格式文件将obj文件压缩成drc文件后将大大减小文件大小(threejs加载有mtl文件的drc文件)
问题描述:当前threejs是92版本 但是当前版本还没有能够直接加载带贴图文件的drc格式的loader: 解决办法:先加载mtl文件将obj文件分解(按照mtl文件内材质贴图信息进行分解)再将分解 ...
- 10.16JS日记
1.parseint() 2.parsefloat() 这两个单词运行的时候遇到第一个非数字就结束了 3.var a="hello word" a这个变量为字符串,每一个字母为字 ...
- Java并发-懒汉式单例设计模式加volatile的原因
懒汉式单例的double check.例一: class SingletonClass{ private static SingletonClass instance = null; private ...
- 当时钟事件声明为过程变量 让system.threading.timer时钟失效
这个项目的小模块就是画label 控件到tablepayoutpanel表单 之中, 中间用到了时钟,事件(带返回值的),哈希表 .由于时钟定义在 form1的启动构造函数中导致了form1,启动完毕 ...
- 简易Java文本编译器(C++)
如何使用VS写一个Java的文本"编译器 "? 所需程序: 1.Visual Studio 2.JDK 你是否因为习惯于使用VS编译C/C++程序,在学java的时候改用新编译器而 ...
- PAT 1038 统计同成绩学生(20)(代码)
1038 统计同成绩学生(20)(20 分) 本题要求读入N名学生的成绩,将获得某一给定分数的学生人数输出. 输入格式: 输入在第1行给出不超过10^5^的正整数N,即学生总人数.随后1行给出N名学生 ...
- nginx 的 负载均衡
一.正向代理和反向代理 1.正向代理 正向代理类似一个跳板机,代理访问外部资源. 正向代理是客户端和目标服务器之间的代理服务器(中间服务器).为了从指定的服务器取得内容,客户端向代理服务器发送一个请求 ...
- export export defalut
require/exports 和 import/export 形式不一样 require/exports 的用法只有以下三种简单的写法: const fs = require('fs') expor ...
- Nowcoder OI赛制测试2 F 假的数学题 - 斯特林公式 + 二分
Description 给定$X$, 找到最小的$N$ 使得$N! > X^X$ 数据范围: $x <= 1e11$ Solution $X^X$ 太大, 高精也存不过, 所以取对数 : ...
- Maven 下载安装
http://www.runoob.com/maven/maven-tutorial.html https://www.yiibai.com/maven/ Maven 提倡使用一个共同的标准目录结构, ...