/** * Creates domain object from received data array. * @param Registrar_Domain $domain * @return Registrar_Domain */ private function _createDomainObj($result, Registrar_Domain $domain) { $type = 'contacts_registrant_'; $tel = explode('.', $result[$type . 'phonenumber']); // domain specific if (array_key_exists($type . 'firstname', $result)) { $name = $result[$type . 'firstname']; } if (array_key_exists($type . 'lastname', $result)) { $name .= ' ' . $result[$type . 'lastname']; } if (!array_key_exists($type . 'organization', $result)) { $result[$type . 'organization'] = ''; } if ($domain->getTld() == 'fr') { $name = $result[$type . 'dotfrcontactentityname']; } if ($domain->getTld() == 'it') { $result['transferauthinfo'] = ''; } $c = new Registrar_Domain_Contact(); $c->setName($name)->setEmail($result[$type . 'email'])->setCompany($result[$type . 'organization'])->setTel($tel[1])->setTelCc($tel[0])->setAddress1($result[$type . 'street'])->setAddress2($result[$type . 'street2'])->setAddress3($result[$type . 'street3'])->setCity($result[$type . 'city'])->setCountry($result[$type . 'country'])->setZip($result[$type . 'postalcode']); if (isset($result['nameserver_0'])) { $domain->setNs1($result['nameserver_0']); } if (isset($result['nameserver_1'])) { $domain->setNs2($result['nameserver_1']); } if (isset($result['nameserver_2'])) { $domain->setNs3($result['nameserver_2']); } if (isset($result['nameserver_3'])) { $domain->setNs4($result['nameserver_3']); } $privacy = 0; if (array_key_exists('privatewhois', $result)) { $privacy = $result['privatewhois'] == 'FULL' || $result['privatewhois'] == 'PARTIAL'; } $domain->setExpirationTime(strtotime($result['expirationdate'])); $domain->setPrivacyEnabled($privacy); $domain->setEpp($result['transferauthinfo']); $domain->setContactRegistrar($c); return $domain; }
public function getDomainDetails(Registrar_Domain $domain) { $params = array('command' => 'GetWhoisContact', 'SLD' => $domain->getSld(), 'TLD' => $domain->getTld()); $result = $this->_makeRequest($params); if (isset($result->RRPCode) && $result->RRPCode != 200) { throw new Registrar_Exception(sprintf('EnomApiError: "%s"', implode(', ', $result->errors)), 100); } $rrp = $result->GetWhoisContacts->{'rrp-info'}; $domain->setRegistrationTime(strtotime((string) $rrp->{'updated-date'})); $domain->setExpirationTime(strtotime((string) $rrp->{'registration-expiration-date'})); $domain->setEpp('ENOM'); //nameservers $params = array('command' => 'GetDomainInfo', 'TLD' => $domain->getTld(), 'SLD' => $domain->getSld()); $result = $this->_makeRequest($params); if (isset($result->GetDomainInfo->services->entry) && !empty($result->GetDomainInfo->services->entry)) { foreach ($services = $result->GetDomainInfo->services->entry as $service) { if (isset($service->service) && (int) $service->service == 1012) { $ns = $service->configuration->dns; } elseif (isset($service->service) && (int) $service->service == 1120 && isset($service->configuration)) { $domain->setPrivacyEnabled(true); } } $ns_list = array(); foreach ($ns as $s) { $s = (string) $s; $n = new Registrar_Domain_Nameserver(); $ns_list[] = $n->setHost($s); } $domain->setNameservers($ns_list); } //contacts $params = array('command' => 'getcontacts', 'TLD' => $domain->getTld(), 'SLD' => $domain->getSld()); $result = $this->_makeRequest($params); $wc = $result->GetContacts->Registrant; $t = $this->_separateTelephone($wc->RegistrantPhone); $telcc = isset($t['code']) ? $t['code'] : ''; $tel = isset($t['tel']) ? $t['tel'] : str_replace(array(' ', '.', '(', ')', '-'), '', $wc->Phone); $c = new Registrar_Domain_Contact(); $c->setName((string) $wc->RegistrantFirstName . ' ' . (string) $wc->RegistrantLastName)->setFirstName((string) $wc->RegistrantFirstName)->setLastName((string) $wc->RegistrantLastName)->setEmail((string) $wc->RegistrantEmailAddress)->setCompany((string) $wc->RegistrantOrganizationName)->setTel($tel)->setTelCc($telcc)->setAddress1((string) $wc->RegistrantAddress1)->setCity((string) $wc->RegistrantCity)->setCountry((string) $wc->RegistrantCountry)->setState((string) $wc->RegistrantStateProvince)->setZip((string) $wc->RegistrantPostalCode)->setId(00); if (isset($wc->RegistrantAddress2)) { $c->setAddress2((string) $wc->RegistrantAddress2); } $domain->setContactRegistrar($c); return $domain; }