$params) { $cl = new TemphumdClient(...$params); $clients[$key] = $cl; $cl->readSensor(); } $this->tpl->set(['sensors' => $clients]); $this->tpl->set_title('Датчики'); $this->tpl->render_page('sensors.twig'); } public function GET_cams_stat() { global $config; list($ip, $port) = explode(':', $config['ipcam_server_api_addr']); $body = jsonDecode(file_get_contents('http://'.$ip.':'.$port.'/api/timestamp/all')); header('Content-Type: text/plain'); $date_fmt = 'd.m.Y H:i:s'; foreach ($body['response'] as $cam => $data) { $fix = date($date_fmt, $data['fix']); $start = date($date_fmt, $data['motion_start']); $motion = date($date_fmt, $data['motion']); echo "$cam:\n motion: $motion\n"; echo " motion_start: $start\n"; echo " fix: $fix\n\n"; } } }