get_channel_uptime.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_uptime.php
description:
use token to get channel 1 uptime.
<?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_uptime with token for Channe1 1
$ch_no=1;
$apiurl=vsprintf("http://%s:%s/server/get_channel_uptime?token=%s&ch_no=%s",array($szezserverip,$szAPIport,$sztoken,$ch_no));
$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);
?>
|