Пример #1
0
 /**
  * This method request registry for information about domain
  * 
  * @param Domain $domain 
  * @return GetRemoteDomainResponse
  */
 public function GetRemoteDomain(Domain $domain)
 {
     $hostname = $domain->GetHostName();
     $is_idn = $this->RegistryAccessible->IsIDNHostName($hostname);
     $params = array('name' => $is_idn ? $this->RegistryAccessible->PunycodeEncode($hostname) : $hostname);
     $response = $this->Request("domain-info", $params);
     $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
     $ret = new GetRemoteDomainResponse($status, $response->ErrMsg, $response->Code);
     if ($ret->Succeed()) {
         $info = $response->Data->response->resData->children($this->XmlNamespaces['domain']);
         $info = $info[0];
         $ret->CRID = (string) $info->crID[0];
         $ret->CLID = (string) $info->clID[0];
         if ($ret->CLID) {
             // Contacts
             $ret->RegistrantContact = (string) $info->registrant[0];
             $contact = $info->xpath('domain:contact[@type="admin"]');
             $ret->AdminContact = (string) $contact[0];
             $contact = $info->xpath('domain:contact[@type="tech"]');
             $ret->TechContact = (string) $contact[0];
             $ret->CreateDate = strtotime($info->crDate[0]);
             $ret->ExpireDate = strtotime($info->exDate[0]);
             // Nameservers
             $ns_arr = array();
             foreach ($info->xpath('domain:ns/domain:hostObj') as $hostObj) {
                 $hostname = (string) $hostObj;
                 if (FQDN::IsSubdomain($hostname, $domain->GetHostName())) {
                     try {
                         $ip = $this->GetHostIpAddress($hostname);
                         $ns_arr[] = new NameserverHost($hostname, $ip);
                     } catch (Exception $e) {
                         $ns_arr[] = new NameserverHost($hostname, '');
                     }
                 } else {
                     // nameserver
                     $ns_arr[] = new Nameserver($hostname);
                 }
             }
             $ret->SetNameserverList($ns_arr);
             // Flags
             $flags = array();
             if ($nodes = $info->xpath('domain:status/@s')) {
                 foreach ($nodes as $flag) {
                     $flags[] = (string) $flag;
                 }
             }
             if ($nodes = $response->Data->xpath('//dnslu:domain/dnslu:status')) {
                 foreach ($nodes as $flag) {
                     $flags[] = (string) $flag;
                 }
             }
             $ret->RegistryStatus = (string) $flags[0];
             $flags = array_filter($flags);
             // Remove default 'ok' status from domain flags
             if (($i = array_search("ok", $flags)) !== false) {
                 array_splice($flags, $i, 1);
             }
             $ret->SetFlagList($flags);
         }
         $ret->AuthCode = '';
         $ret->Protocol = '';
     }
     return $ret;
 }
Пример #2
0
 /**
  * This method request registry for information about domain
  * 
  * @param Domain $domain 
  * @return GetRemoteDomainResponse
  */
 public function GetRemoteDomain(Domain $domain)
 {
     $Resp = $this->Whois($domain);
     $status = $Resp->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
     $Ret = new GetRemoteDomainResponse($status, $Resp->ErrMsg);
     if ($Ret->Succeed()) {
         $ns_arr = array();
         foreach ($Resp->Data as $k => $v) {
             if (stristr($k, "DNS SERVER")) {
                 $hostname = (string) $v;
                 if (FQDN::IsSubdomain($hostname, $domain->GetHostName())) {
                     try {
                         $ip = $this->GetHostIpAddress($hostname);
                         $ns_arr[] = new NameserverHost($hostname, $ip);
                     } catch (Exception $e) {
                         $ns_arr[] = new NameserverHost($hostname, '');
                     }
                 } else {
                     // nameserver
                     $ns_arr[] = new Nameserver($hostname);
                 }
             }
         }
         $Ret->SetNameserverList($ns_arr);
         $Ret->CRID = $this->Config->GetFieldByName('Login')->Value;
         $Ret->CLID = $this->Config->GetFieldByName('Login')->Value;
         $Ret->CreateDate = (int) $Resp->Data['REGISTRATION DATE'];
         $Ret->ExpireDate = (int) $Resp->Data['EXPIRATION DATE'];
         $Ret->RegistryStatus = 'ok';
         $Ret->RegistrantContact = $Resp->Data['RESPONSIBLE PERSON'];
         $Ret->BillingContact = $Resp->Data['BILLING CONTACT'];
         $Ret->AdminContact = $Resp->Data['ADMIN CONTACT'];
         $Ret->TechContact = $Resp->Data['TECHNICAL CONTACT'];
     }
     return $Ret;
 }