kepware http接口 c语言(libcrul)开发

Posted dxiot

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kepware http接口 c语言(libcrul)开发相关的知识,希望对你有一定的参考价值。

列出所有变量

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "http://127.0.0.1:39321/iotgateway/browse");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Postman-Token: 0b95f019-57f6-49cc-b94a-8f90505f9a90");
headers = curl_slist_append(headers, "cache-control: no-cache");
headers = curl_slist_append(headers, "Accept-Language: zh-CN,zh;q=0.9");
headers = curl_slist_append(headers, "Accept-Encoding: gzip, deflate, br");
headers = curl_slist_append(headers, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
headers = curl_slist_append(headers, "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36");
headers = curl_slist_append(headers, "Upgrade-Insecure-Requests: 1");
headers = curl_slist_append(headers, "Cache-Control: max-age=0");
headers = curl_slist_append(headers, "Connection: keep-alive");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);

 

读取某变量的值

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "http://127.0.0.1:39321/iotgateway/read?ids=Channel1.Device1.tag1,Channel1.Device1.tag2");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Postman-Token: 12a8d1f3-ef0e-45a0-9ae7-b078b62902ca");
headers = curl_slist_append(headers, "cache-control: no-cache");
headers = curl_slist_append(headers, "Accept-Language: zh-CN,zh;q=0.9");
headers = curl_slist_append(headers, "Accept-Encoding: gzip, deflate, br");
headers = curl_slist_append(headers, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
headers = curl_slist_append(headers, "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36");
headers = curl_slist_append(headers, "Upgrade-Insecure-Requests: 1");
headers = curl_slist_append(headers, "Cache-Control: max-age=0");
headers = curl_slist_append(headers, "Connection: keep-alive");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);

 

以上是关于kepware http接口 c语言(libcrul)开发的主要内容,如果未能解决你的问题,请参考以下文章

C语言或者C++如何调用一个http接口并得到返回结果?

从kepware定时取web api内容

Kepware连接OPC服务器设置

Kepware连接Modbus TCP设置

JAVA调用C语言发布的webservice接口

iOS开发之SQLite-C语言接口规范——Ready And Open Your SQLite