get_channel_group.php
/*******************************************
menu.js : EZserver API Samples
Author: EZhometech
Initial Date: 09/30/2016
Modified Date: 09/30/2016
http://www.ezhometech.com
sales@ezhometech.com
Copyright: EZhometech Inc.
********************************************/
filename: get_channel_group.php
description:
use token to get channel group and total channel no..
<?php
$szezserverip="192.168.0.10";
$szAPIport="17000";
$szuserid="root";
$szpassword="1234";
$str=vsprintf("%s:%s",array($szuserid,$szpassword));
$strenc=base64_encode($str);
// Web API: createtokenbased64
$apiurl=vsprintf("http://%s:%s/token/createtokenbased64?encrpty=%s",array($szezserverip,$szAPIport,$strenc));
$szreponse = file_get_contents($apiurl);
// Get token
$sztoken=substr($szreponse,6,strlen($szreponse)-8);
// Web API: get_channel_group with token
$apiurl=vsprintf("http://%s:%s/server/get_channel_group?token=%s",array($szezserverip,$szAPIport,$sztoken));
$ezresult = file_get_contents($apiurl);
echo $ezresult;
echo '<br>';
// Web API: get_channel_no with token
$apiurl=vsprintf("http://%s:%s/server/get_channel_no?token=%s",array($szezserverip,$szAPIport,$sztoken));
$ezresult = file_get_contents($apiurl);
echo $ezresult;
// Web API: destroytoken with token
$apiurl=vsprintf("http://%s:%s/token/destroytoken?token=%s",array($szezserverip,$szAPIport,$sztoken));
$szuptime = file_get_contents($apiurl);
?>
|