/** * @param string|array $responseHeader */ public function setResponseHeader($responseHeader) { if (is_string($responseHeader)) { require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Utils' . DIRECTORY_SEPARATOR . 'HttpParseHeaders.php'; $responseHeader = http_parse_headers($responseHeader); } if (isset($responseHeader['ClientId'])) { $this->smartHome->setClientId($responseHeader['ClientId']); } $this->responseHeader = $responseHeader; }
if (file_exists($configFile)) { try { $config = new SimpleXMLElement($configFile, 0, true); } catch (Exception $ex) { } } $sh = new SmartHome('Hostname or IP address', 'Username', 'Password'); if (!file_exists($configFile)) { $config->addChild('SessionId', $sh->getSessionId()); $config->addChild('ClientId', $sh->getClientId()); $config->addChild('Version', $sh->getVersion()); $config->addChild('ConfigurationVersion', $sh->getConfigVersion()); $config->saveXML($configFile); } $sh->setSessionId((string) $config->SessionId); $sh->setClientId((string) $config->ClientId); $sh->setVersion((string) $config->Version); $sh->setConfigVersion((string) $config->ConfigurationVersion); // get your current session id echo 'Your session id is ' . $sh->getSessionId() . $newLine; // get your current session id echo 'Your current client id is ' . $sh->getClientId() . $newLine; // get your current version echo 'Your current version is ' . $sh->getVersion() . $newLine; // get your current configuration version echo 'Your current configuration version is ' . $sh->getConfigVersion() . $newLine; // Load all entities (full configuration: LogicalDevices, Locations etc.) echo 'Loading full configuration...' . $newLine; $sh->getEntities(); // Load only locations // $sh->getEntities('Locations');