public function loadDomainInfo($reloadSessionIfTimeouted = true) { $url = str_replace("{DOM}", $this->getDomainName(), str_replace("{SESSID}", $this->sessionStorage->get(), $this->domainInfoUrl)); try { $response = new Response($this->httpConnection->get($url)); } catch (\sknic\HttpRedirectException $error) { $response = new Response($error->getResponse()); } if (!$response->isLogged()) { if (!$reloadSessionIfTimeouted) { return false; } if ($response->isSessionTimeouted()) { $this->startNewSession(); } $this->login(); return $this->loadDomainInfo(false); } $body = $response->convertBody('iso-8859-2'); $responseStripped = strip_tags($body); $responseStripped = str_replace(" ", "", $responseStripped); //echo $responseStripped; if (strpos($responseStripped, "Doména je voľná") !== false) { $this->state = 'FREE'; return true; } preg_match("/Držiteľ domény\\s+(?P<owner>\\w+-\\d+)/", $responseStripped, $matches); if (!isset($matches['owner'])) { return false; // parse error } $this->owner = $matches['owner']; preg_match("/Registrátor\\s+(?P<registrar>\\w+-\\d+)/", $responseStripped, $matches); if (isset($matches['registrar'])) { $this->registrar = $matches['registrar']; } preg_match("/Stav domény\\s+(?P<state>\\w+)/", $responseStripped, $matches); if (!isset($matches['state'])) { return false; // parse error } $this->state = $matches['state']; preg_match("/Posledna zmena stavu\\s+(?P<lastStateChange>\\d+.\\d+.\\d+)/", $responseStripped, $matches); if (isset($matches['lastStateChange'])) { $this->lastStateChange = $matches['lastStateChange']; } preg_match("/Platna do\\s+(?P<expirationDate>\\d+.\\d+.\\d+)/", $responseStripped, $matches); if (isset($matches['expirationDate'])) { $this->expirationDate = $matches['expirationDate']; } return true; }
public function getProformaVariableSymbol($domain) { $token = $this->searchDomain($domain); // Reguest to view proforma try { $url = str_replace(array('{SESSID}', '{TOKEN}'), array($this->sessionStorage->get(), $token), $this->domainProformUrl); $response = new Response($this->httpConnection->get($url)); } catch (\sknic\HttpRedirectException $error) { $response = new Response($error->getResponse()); } // proforma summary list try { $url = str_replace("{SESSID}", $this->sessionStorage->get(), $this->domainProformListUrl); $response = new Response($this->httpConnection->get($url)); } catch (\sknic\HttpRedirectException $error) { $response = new Response($error->getResponse()); } // make final proforma try { $url = str_replace("{SESSID}", $this->sessionStorage->get(), $this->proformaSelectedDomainUrl); $response = new Response($this->httpConnection->post($url, array('pay' => $token, 'user_send' => 'Odosla» >>', 'cmd' => '11'))); } catch (\sknic\HttpRedirectException $error) { $response = new Response($error->getResponse()); } // proforma summary list try { $url = str_replace("{SESSID}", $this->sessionStorage->get(), $this->domainProformListUrl); $response = new Response($this->httpConnection->get($url)); } catch (\sknic\HttpRedirectException $error) { $response = new Response($error->getResponse()); } // Return variable symbol $body = $response->convertBody('iso-8859-2'); $regex = '#<b>([^<]*)</b>#'; preg_match_all($regex, $body, $matches); return $matches[1][7]; }