/** * 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; }
/** * This method request registry for information about domain * * @param Domain $domain * @return GetRemoteDomainResponse */ public function GetRemoteDomain(Domain $domain) { $params = array( "name" => $this->MakeNameIDNCompatible($domain->GetHostName()), 'authinfo' => '' ); if ($domain->AuthCode) $params['authinfo'] = "<domain:authInfo><domain:pw>{$domain->AuthCode}</domain:pw></domain:authInfo>"; $this->BeforeRequest('domain-info', $params, __METHOD__, $domain); $response = $this->Request("domain-info", $params); $status = ($response->Succeed) ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED; $resp = new GetRemoteDomainResponse($status, $response->ErrMsg, $response->Code); $resp->RawResponse = $response->Data; if ($response->Succeed) { $info = $response->Data->response->resData->children($this->XmlNamespaces['domain']); $info = $info[0]; $resp->CLID = (string)$info->clID[0]; try { $resp->CRID = (string)$info->crID[0]; } catch(Exception $e){} if ($resp->CRID) { $resp->AuthCode = ($info->authInfo[0]) ? (string)$info->authInfo[0]->pw[0] : ""; $resp->CreateDate = $this->StrToTime((string)$info->crDate[0]); if ($info->exDate[0]) { $resp->ExpireDate = $this->StrToTime((string)$info->exDate[0]); } // Get contacts foreach ($info->contact as $k=>$v) { $attrs = $v->attributes(); $ctype = (string)$attrs["type"]; switch($ctype) { case "admin": $resp->AdminContact = (string)$v; break; case "tech": $resp->TechContact = (string)$v; break; case "billing": $resp->BillingContact = (string)$v; break; } } $resp->RegistrantContact = (string)$info->registrant[0]; // Get nameservers $ns_arr = array(); $registryOptionsConfig = $this->Manifest->GetRegistryOptions(); if ((bool)$registryOptionsConfig->ability->hostattr) { // Iterate over hostAttr if ($info->ns->hostAttr) { foreach ($info->ns->hostAttr as $hostAttr) { $hostName = (string)$hostAttr->hostName; if ($hostAttr->hostAddr[0]) { $ns = new NameserverHost($hostName, (string)$hostAttr->hostAddr[0]); } else { $ns = new Nameserver($hostName); } $ns_arr[] = $ns; } } } else { // Iterate over hostObj if ($info->ns->hostObj) { foreach ($info->ns->hostObj as $v) { $hostname = (string)strtolower($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); } } } } $resp->SetNameserverList($ns_arr); // Flags (Domain status) $flags = array(); foreach ($info->status as $status) { $flags[] = (string)$status->attributes()->s; } $resp->RegistryStatus = (string)$flags[0]; // Remove default 'ok' status from domain flags if (($i = array_search("ok", $flags)) !== false) { array_splice($flags, $i, 1); } $resp->SetFlagList($flags); } } return $resp; }
/** * This method request registry for information about domain * * @param Domain $domain * @return GetRemoteDomainResponse */ public function GetRemoteDomain(Domain $domain) { $params = array("name" => $this->MakeNameIDNCompatible($domain->GetHostName()), 'authinfo' => '', 'subproduct' => 'dot' . strtoupper($this->Extension)); if ($domain->AuthCode) { $params['authinfo'] = "<domain:authInfo><domain:pw>{$domain->AuthCode}</domain:pw></domain:authInfo>"; } $response = $this->Request("domain-info", $params); $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED; $resp = new GetRemoteDomainResponse($status, $response->ErrMsg, $response->Code); $response->Data->registerXPathNamespace('rgp', $this->XmlNamespaces['rgp']); if ($response->Succeed) { $info = $response->Data->response->resData->children($this->XmlNamespaces['domain']); $info = $info[0]; $resp->CLID = (string) $info->clID[0]; try { $resp->CRID = (string) $info->crID[0]; } catch (Exception $e) { } if ($resp->CRID) { $resp->AuthCode = $info->authInfo[0] ? (string) $info->authInfo[0]->pw[0] : ""; $resp->CreateDate = $this->StrToTime((string) $info->crDate[0]); $resp->ExpireDate = $this->StrToTime((string) $info->exDate[0]); // Request whois for contacts $domain_whois = $this->Db->GetRow("\r\n\t\t\t\t\t\tSELECT * FROM whois_domain WHERE domain = ?", array($domain->GetHostName())); if ($domain_whois) { $resp->RegistrantContact = $this->PersonIdToCLID($domain_whois['holder']); $resp->AdminContact = $this->PersonIdToCLID($domain_whois['admin_c']); $resp->TechContact = $this->PersonIdToCLID($domain_whois['tech_c']); $resp->BillingContact = $this->PersonIdToCLID($domain_whois['bill_c']); } // Get nameservers $ns_arr = array(); if ($info->ns) { foreach ($info->ns->hostObj as $v) { $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); } } } $resp->SetNameserverList($ns_arr); // Flags (Domain status) $flags = array(); if ($nodes = $info->xpath('domain:status/@s')) { foreach ($nodes as $flag) { $flags[] = (string) $flag; } } // Not works. Why ?? // if ($nodes = $response->Data->response->xpath('//rgp:infData/rgp:rgpStatus/@s')) // foreach ($nodes as $flag) // $flags[] = (string)$flag; // Intead of glamour XPath expression use ugly hack if ($response->Data->response->extension) { $rgpInfo = $response->Data->response->extension->children($this->XmlNamespaces['rgp']); foreach ($rgpInfo->rgpStatus as $status) { $flag[] = (string) $status->attributes()->s; } } $resp->SetFlagList($flags); $resp->RegistryStatus = $flags[0]; } } return $resp; }