/** * 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) { $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; }
/** * Return information about domain * * @access public * @param Domain $domain * @return GetRemoteDomainResponse Domain info if the following format: */ public function GetRemoteDomain(Domain $domain) { $params = array( "name" => $this->MakeNameIDNCompatible($domain->GetHostName()), 'authinfo' => '' ); if ($domain->AuthCode) $params['authinfo'] = "<domain:authInfo><domain:pw>".$this->EscapeXML($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); if ($response->Succeed) { $info = $response->Data->response->resData->children("urn:ietf:params:xml:ns:domain-1.0"); $info = $info[0]; $resp->CLID = (string)$info->clID[0]; $resp->AuthCode = ($info->authInfo[0]) ? (string)$info->authInfo[0]->pw[0] : ""; if ($info->exDate[0]) { $resp->ExpireDate = $this->StrToTime((string)$info->exDate[0]); $resp->CreateDate = $resp->ExpireDate-(86400*365); } foreach ($info->contact as $k=>$v) { $attrs = $v->attributes(); $ctype = (string)$attrs["type"]; switch($ctype) { case "tech": $resp->TechContact = (string)$v; break; } } $resp->RegistrantContact = (string)$info->registrant[0]; // Get nameservers $ns_arr = array(); 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); if ($info->status[0]) $attrs = $info->status[0]->attributes(); elseif ($info->status) $attrs = $info->status->attributes(); else $attrs["s"] = false; $resp->RegistryStatus = (string)$attrs["s"]; } return $resp; }
/** * Return information about domain * * @access public * @param Domain $domain * @return Domain Domain info if the following format: */ public function GetRemoteDomain(Domain $domain) { $params["domain"] = $this->MakeNameIDNCompatible($domain->GetHostName()); $response = $this->Request("StatusDomain", $params); $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED; $resp = new GetRemoteDomainResponse($status, $response->ErrMsg, $response->Code); if ($response->Succeed) { mparse_str(str_replace("\n", "&", $response->Data), $parsed_response); $data = array(); foreach ($parsed_response["property"] as $fname => $fvalue) { switch ($fname) { case "owner contact": $resp->RegistrantContact = trim($fvalue[0]); break; case "admin contact": $resp->AdminContact = trim($fvalue[0]); break; case "tech contact": $resp->TechContact = trim($fvalue[0]); break; case "billing contact": $resp->BillingContact = trim($fvalue[0]); break; case "auth": $resp->AuthCode = trim($fvalue[0]); break; case "registrar": $resp->CLID = trim($fvalue[0]); break; case "created by": $resp->CRID = trim($fvalue[0]); break; case "created date": $resp->CreateDate = strtotime(trim($fvalue[0])); break; case "registration expiration date": $resp->ExpireDate = strtotime(trim($fvalue[0])); break; case "nameserver": foreach ($fvalue as $ns) { $ns_arr[] = new Nameserver(trim(strtolower($ns))); } $resp->SetNameserverList($ns_arr); break; case "status": $resp->RegistryStatus = trim($fvalue[0]); break; } } //// // Process extra fields: // // Collect extra fields $domainConfig = $this->Manifest->GetDomainConfig(); $extraFieldNames = array(); if (count($domainConfig->extra_fields)) { foreach ($domainConfig->extra_fields->field as $field) { $extraFieldNames[] = strtoupper($field->attributes()->name); } } // Iterate over response properties and fill extra fields $extraFields = array(); foreach ($parsed_response["property"] as $fname => $fvalue) { $fname = strtoupper($fname); if (in_array($fname, $extraFieldNames)) { $extraFields[$fname] = trim($fvalue[0]); } } $resp->SetExtraData($extraFields); $resp->RawResponse = $parsed_response; } return $resp; }
/** * Return information about domain * * @access public * @param Domain $domain * @return GetRemoteDomainResponse */ public function GetRemoteDomain(Domain $domain) { if ($domain->AuthCode) { $pw = "<domain:authInfo>\r\n\t\t\t\t\t\t<domain:pw>" . $this->EscapeXML($domain->AuthCode) . "</domain:pw>\r\n\t\t\t\t\t</domain:authInfo>"; } else { $pw = ''; } $response = $this->Request("domain-info", array("name" => "{$domain->Name}.{$this->Extension}", "pw" => $pw)); $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED; $resp = new GetRemoteDomainResponse($status, $response->ErrMsg, $response->Code); if ($response->Succeed) { $info = $response->Data->response->resData->children("urn:ietf:params:xml:ns:domain-1.0"); $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]); $extdomain = $response->Data->response->extension->children("urn:ics-forth:params:xml:ns:extdomain-1.1"); $resp->Protocol = (string) $extdomain->resData->protocol[0]; 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 // TODO: testit $ns_arr = array(); 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); if ($info->status[0]) { $attrs = $info->status[0]->attributes(); } elseif ($info->status) { $attrs = $info->status->attributes(); } else { $attrs["s"] = false; } $resp->RegistryStatus = (string) $attrs["s"]; } } 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; }
/** * This method request registry for information about domain * * @param Domain $domain * @return GetRemoteDomainResponse */ public function GetRemoteDomain(Domain $domain) { $params = array('name' => $domain->GetHostName(), 'clID' => $this->Config->GetFieldByName('Login')->Value, 'type' => $this->GetDomainType()); $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 ($response->Succeed) { $info = $response->Data->response->resData; // nameservers $nslist = array(new Nameserver(trim((string) $info->domain_creData->dns1)), new Nameserver(trim((string) $info->domain_creData->dns2))); $ret->SetNameserverList($nslist); $ret->CRID = $this->Config->GetFieldByName('Login')->Value; $ret->CLID = $this->Config->GetFieldByName('Login')->Value; $ret->CreateDate = strtotime($info->domain_creData->regdate); $ret->ExpireDate = strtotime($info->domain_creData->expdate); $ret->RegistryStatus = 'ok'; } return $ret; }
/** * Obtain information about specific domain from registry * * @param Domain $domain * @return GetRemoteDomainResponse */ public function GetRemoteDomain(Domain $domain) { $params = array('SLD' => $this->MakeNameIDNCompatible($domain->Name), 'TLD' => $this->Extension); $Resp = $this->Request('GetDomainInfo', $params); if (!$Resp->Succeed) { $Ret = new GetRemoteDomainResponse(REGISTRY_RESPONSE_STATUS::FAILED, $Resp->ErrMsg, $Resp->Code); return $Ret; } $Ret = new GetRemoteDomainResponse(REGISTRY_RESPONSE_STATUS::SUCCESS, $Resp->ErrMsg, $Resp->Code); $Ret->CLID = (string) $Resp->Data->GetDomainInfo->status->{'belongs-to'}; $Ret->CRID = (string) $Resp->Data->GetDomainInfo->status->{'belongs-to'}; $Ret->ExpireDate = strtotime($Resp->Data->GetDomainInfo->status->{'expiration'}); $Ret->RegistryStatus = (string) $Resp->Data->GetDomainInfo->status->{'registrationstatus'}; $Resp = $this->Request('GetWhoisContact', $params); $cr_date = strtotime($Resp->Data->GetWhoisContacts->{'rrp-info'}->{'created-date'}); # FIXME: # GetWhoisContact is the only one method to get domain create date, # and holy f**k!!! it doesn't returns it for .eu domain names: # "EURid Regulations have strict guidelines regarding the display of .EU Whois information. # Please check www.whois.eu for domain information." # Set it to 1 year before expiration date, and collect bug reports. # Thank you Enom. $Ret->CreateDate = $cr_date ? $cr_date : strtotime("-1 year", $Ret->ExpireDate); // Get Auth Code $Resp = $this->Request('GetPasswordBit', $params); $Ret->AuthCode = (string) $Resp->Data->DomainPassword; // Get DNS $Resp = $this->Request('GetDNS', $params); foreach ($Resp->Data->dns as $ns) { $list[] = new Nameserver((string) $ns); } $Ret->SetNameserverList($list); // TODO: process ns hosts // Get Lock $Resp = $this->Request('GetRegLock', $params); $Ret->IsLocked = (string) $Resp->Data->{'reg-lock'} == '1'; // Get Contacts $Resp = $this->Request('GetContacts', $params); $Ret->RegistrantContact = (string) $Resp->Data->GetContacts->Registrant->RegistrantPartyID; if ($AuxBilling = $Resp->Data->GetContacts->AuxBilling) { $Ret->BillingContact = (string) $AuxBilling->AuxBillingPartyID; } if ($Tech = $Resp->Data->GetContacts->Tech) { $Ret->TechContact = (string) $Tech->TechPartyID; } if ($Admin = $Resp->Data->GetContacts->Admin) { $Ret->AdminContact = (string) $Admin->AdminPartyID; } return $Ret; }