PHP code example of imactool / hikcloud
1. Go to this page and download the library: Download imactool/hikcloud library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
imactool / hikcloud example snippets
use Imactool\Hikcloud\HikCloud;
$config = [
'client_id' => '客户端ID',
'client_secret' => '访问密钥'
];
$hikCloud = new HikCloud($config);
//开始使用
$params = [
'communityName' =>'龙湖社区',
'provinceCode' =>'130002',
'addressDetail' =>'玉兰大道与黄山路交叉口192号'
];
$res = $hikCloud->Communit->communities($params);
var_dump($res);
#1、分页查询云眸社区租户下的社区
$params = [
'pageNo'=>1,
'pageSize'=>100
];
$res = $hik->Communit->getCommunities($params);
var_export($res);
#2、查询社区下的设备列表
$params = [
'communityId'=>'123456789',
'pageNo'=>2,
'pageSize'=>100
];
$res = $hik->Device->getDeviceByCommunityId($params);
var_export($res);
#3、查询社区下设备通道列表
$params = [
'communityId'=>'123456789',
'pageNo'=>2,
'pageSize'=>100
];
$res = $hik->Device->getDeviceChannelByCommunityId($params);
var_dump($res);
#4、 获取标准流预览地址(支持6000C子设备通道。)
$params = [
'channelId' => '1234526789',
'protocol' => 4,
'expireTime' => 180
];
$res = $hik->Device->getLiveAddressNew($params);
var_dump($res);
#查询设备详情
$deviceId = '744e45a58f1c45aa84096fc00476ce53';
$res = $hik->Device->getDeviceInfo($deviceId);
var_dump($res);