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 ...
随机推荐
- 19.Mysql优化数据库对象
19.优化数据库对象19.1 优化表的数据类型应用设计时需要考虑字段的类型和长度,并留有一定长度冗余.procedure analyse()函数可以对表中列的数据类型提出优化建议.procedure ...
- AsyncTask的缺陷
导语:在开发Android应用的过程中,我们需要时刻注意保障应用的稳定性和界面响应性,因为不稳定或者响应速度慢的应用将会给用户带来非常差的交互体验.在越来越讲究用户体验的大环境下,用户也许会因为应用的 ...
- Centos7 开机启动命令行模式
1.在图形界面下单击鼠标右键,选择“Konsole”: 2. 获取当前系统启动模式,输入:systemctl get-default 3.查看配置文件, cat /etc/inittab 4.通过以上 ...
- POJ 3621Sightseeing Cows 0/1 分数规划
Description 作为对奶牛们辛勤工作的回报,Farmer John决定带她们去附近的大城市玩一天.旅行的前夜,奶牛们在兴奋地 讨论如何最好地享受这难得的闲暇. 很幸运地,奶牛们找到了一张详细的 ...
- VS2010错误
1.用VS2010生成C++程序时,链接器工具错误 LNK1123: fatal error LNK1123: failure during conversion to COFF: file inva ...
- kdump 调试手段
kdump是在系统崩溃的时候用来转储内存运行参数的一个工具和服务,打个比方,如果系统一旦崩溃那么正常的内核就没有办法工作了,在这个时候将由kdump产生一个用于capture当前运行信息的内核,该内核 ...
- Use Laravel/homestead 环境维护基于 brophp 开发的老项目
1 前言 laravel/homestead 无疑是 laravel 项目开发的最佳环境. 如何使用这个环境维护基于 Brophp (或 Thinkphp) 开发的老项目呢? 以下是测试成功的步骤. ...
- About how fast is fast enough for a web application?
About how fast is fast enough for a web application? Here’s a quick overview of key performance metr ...
- struts2升级
http://www.blogjava.net/ldwblog/archive/2013/10/14/404944.html
- 如何从平面设计转行到UI设计?
时代的变迁,科技的进步,工具的发展,薪资的差距,促使许多人转行的原因,但平面与界面两者之间有着哪些的差异呢?如果,想要转行又该具备哪些条件呢? 平面.界面设计之间的差异性 平面设计以『视觉』为主轴,强 ...