berkas1/ thingspeak_php
用于与thingspeak.com服务通信的PHP库。
1.0.0
2017-05-08 18:15 UTC
Requires (Dev)
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2024-09-29 04:20:12 UTC
README
thingspeak_php是一个提供与thingspeak.com服务通信简单方式的库
只需要php-curl
安装
composer require berkas1/thingspeak_php
使用示例
方法setResponseFormat()可以将响应格式设置为JSON或XML,方法getResponse()将返回从thingspeak.com(JSON或XML)检索到的响应
所有参数($params)都应与此处列出的参数相匹配。
require __DIR__ . '/vendor/autoload.php'; $ts = new \berkas1\thingspeak_php\Api(channel_id, channel_api_key); // you can set required response format, XML and JSON currently supported $ts->setResponseFormat("xml"); // create a channel (you need to provide user api_key in $params) $ts->createChannel($params)->getResponse(); // update a channel $ts->updateChannel($params)->getResponse(); // get a feed $ts->getFeed($params)->getResponse(); // get a field feed $ts->getFieldFeed($fieldId, $params)->getResponse(); // list public channels $ts->listPublicChannels($params)->getResponse(); // get channel status $ts->getStatus()->getResponse();