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 ...
随机推荐
- 关系测试# 或 print(s2-s)Python 集合
1集合是一个无序的,不重复的数据组合,它的主要作用如下(set和dict类似,也是一组key的集合,但不存储value.由于key不能重复,所以,在set中,没有重复的key): 去重,把一个列表变成 ...
- (转)jquery.cookie中的操作
jquery.cookie中的操作: jquery.cookie.js是一个基于jquery的插件,点击下载! 创建一个会话cookie: $.cookie(‘cookieName’,'cooki ...
- How to Solve Lonsdor K518ISE Abnormal Display by Factory Resetting
Here’s the working solution to Lonsdor K518ISE Key Programmer abnormal display after upgrade. Proble ...
- 调试程序时如何用syslog来打印信息
转自:https://www.cnblogs.com/vigarbuaa/archive/2013/02/05/2892544.html Linux下C语言编程的-把程序输出信息加到系统日志里去关键词 ...
- mysqli_query数据库有数据,查不出来
MySQLDB.class.php <?php /** * 数据库操作工具类 */ class MySQLDB { // 定义相关属性 private $host;// 主机地址 private ...
- SQL截取字符串分隔符中间部门的办法
需求:实际项目中需要截取第2到第3个逗号中间部分的内容 方案: declare @str nvarchar(50);set @str='11,222,3333,44444';select @str a ...
- .Net直接将Web页面table导出到Excel
项目管理系统有个统计表需要导出到Excel表中.常用的方法是在后台C#代码查询数据再写入Excel表中最后保存在目标路径. 为减轻数据库服务器的压力和保持页面的样式,能否直接将页面的表格直接导出到Ex ...
- MarkDown,写出个性、漂亮的文档
http://www.markdown.cn # Title1## Title2### Title3content==content2--content3--* name- name+ name * ...
- 【NIFI】 Apache NiFI 之 ExecuteScript处理(一)
本例介绍NiFI ExecuteScript处理器的使用,使用的脚本引擎ECMScript FlowFile I / O简介 NiFi中的流文件由两个主要组件构成,即属性和内容.属性是关于内容/流文件 ...
- hibernate项目
http://blog.csdn.net/wzygis/article/details/22985751