'192.168.1.80', 'name' => 'Vu+' ); $recievers[] = array( 'ip' => '192.168.1.89', 'name' => 'xSarius' ); // tot hier de tabel vervangen / bewerken if (isset($_GET['getInfo'])) { if (isset($_GET['id'])) { $key = $_GET['id']; if ($recievers[$key]) { $status_url = 'http://' . $recievers[$key]['ip'] . '/web/powerstate'; $info_url = 'http://' . $recievers[$key]['ip'] . '/web/deviceinfo'; if (@get_headers($status_url)) { $result = simplexml_load_file($info_url); if ($result) { $json['success']['devicename'] = trim($result->e2devicename); $json['success']['oeversion'] = trim($result->e2oeversion); $json['success']['distroversion'] = trim($result->e2distroversion) . ' ' . trim($result->e2imageversion); $json['success']['tuners'] = array(); $json['success']['hdds'] = array(); foreach ($result->e2frontends->children() as $tuner) { $json['success']['tuners'][] = trim($tuner->e2name) . ' ' . trim($tuner->e2model); } foreach ($result->e2hdds->children() as $hdd) { $json['success']['hdds'][] = array( 'model' => trim($hdd->e2model), 'capacity' => trim($hdd->e2capacity), 'free' => trim($hdd->e2free) ); } } } else { $json['error'][$key] = 'Niet gevonden!'; } } } header('Content-type: application/json', true); echo json_encode($json); } elseif (isset($_GET['sendMessage'])) { $json = array(); if (isset($_GET['id']) && isset($_GET['message'])) { $key = $_GET['id']; if ($recievers[$key]) { $status_url = 'http://' . $recievers[$key]['ip'] . '/web/powerstate'; $send_message_url = 'http://' . $recievers[$key]['ip'] . '/web/message?text=' . urlencode($_GET['message']) . '&type=2'; if (@get_headers($status_url)) { $result = simplexml_load_file($send_message_url); if ($result) { $json['success'][$key]['result'] = trim($result->e2state); $json['success'][$key]['text'] = trim($result->e2statetext); } } else { $json['error'][$key] = 'Niet gevonden!'; } } } header('Content-type: application/json', true); echo json_encode($json); } elseif (isset($_GET['toggleStatus'])) { $json = array(); if (isset($_GET['id']) && isset($_GET['toggleStatus'])) { $key = $_GET['id']; if ($recievers[$key]) { $status_url = 'http://' . $recievers[$key]['ip'] . '/web/powerstate'; $set_status_url = 'http://' . $recievers[$key]['ip'] . '/web/powerstate?newstate=' . $_GET['toggleStatus']; $zender_url = 'http://' . $recievers[$key]['ip'] . '/web/getcurrent'; if (@get_headers($set_status_url)) { $result = simplexml_load_file($status_url); if ($result) { $status_standby = trim($result->e2instandby); $json['success'][$key]['status'] = $status_standby == 'false' ? false:true; } if (@get_headers($zender_url)) { $result = simplexml_load_file($zender_url); if ($result) { $zender = trim($result->e2service->e2servicename); $json['success'][$key]['zender'] = $zender; $ref = trim($result->e2service->e2servicereference); $json['success'][$key]['ref'] = $ref; $json['success'][$key]['ip'] = $recievers[$key]['ip']; } } } else { $json['error'][$key] = 'Niet gevonden!'; } } } header('Content-type: application/json', true); echo json_encode($json); } elseif (isset($_GET['getStatus'])) { $json = array(); foreach ($recievers as $key => $reciever) { $status_url = 'http://' . $reciever['ip'] . '/web/powerstate'; $zender_url = 'http://' . $reciever['ip'] . '/web/getcurrent'; if (@get_headers($status_url)) { $result = simplexml_load_file($status_url); if ($result) { $status_standby = trim($result->e2instandby); $json['success'][$key]['status'] = $status_standby == 'false' ? false:true; } if (@get_headers($zender_url)) { $result = simplexml_load_file($zender_url); if ($result) { $zender = trim($result->e2service->e2servicename); $json['success'][$key]['zender'] = $zender; $ref = trim($result->e2service->e2servicereference); $json['success'][$key]['ref'] = $ref; $json['success'][$key]['ip'] = $reciever['ip']; } } } else { $json['error'][$key] = 'Niet gevonden!'; } } header('Content-type: application/json', true); echo json_encode($json); } else { ?>