public function getDomainDetails(Registrar_Domain $domain) { $params = array('domain' => $domain->getName()); $result = $this->_request('getDomainInfo', $params); $result = $result->reply; $params = array('contact_id' => (string) $result->contact_ids->registrant); $contact = $this->_request('contactList', $params); $contact = $contact->reply->contact; $c = new Registrar_Domain_Contact(); $c->setFirstName((string) $contact->first_name)->setLastName((string) $contact->last_name)->setEmail((string) $contact->email)->setCompany((string) $contact->company)->setTel((string) $contact->phone)->setAddress1((string) $contact->address)->setAddress2((string) $contact->address2)->setCity((string) $contact->city)->setCountry((string) $contact->country)->setZip((string) $contact->zip); // Add nameservers $ns_list = array(); foreach ($result->nameservers->nameserver as $ns) { $n = new Registrar_Domain_Nameserver(); $n->setHost((string) $ns); $ns_list[] = $n; } $privacy = false; if ((string) $result->private == 'Yes') { $privacy = true; } $domain->setNameservers($ns_list); $domain->setExpirationTime(strtotime($result->expires)); $domain->setRegistrationTime(strtotime($result->created)); $domain->setPrivacyEnabled($privacy); //$domain->setEpp(); $domain->setContactRegistrar($c); return $domain; }
protected function _getD(\Model_ServiceDomain $model) { $orderService = $this->di['mod_service']('order'); $order = $orderService->getServiceOrder($model); $tldRegistrar = $this->di['db']->load('TldRegistrar', $model->tld_registrar_id); if ($order instanceof \Model_ClientOrder) { $adapter = $this->registrarGetRegistrarAdapter($tldRegistrar, $order); } else { $adapter = $this->registrarGetRegistrarAdapter($tldRegistrar); } $d = new \Registrar_Domain(); $d->setLocked($model->locked); $d->setNs1($model->ns1); $d->setNs2($model->ns2); $d->setNs3($model->ns3); $d->setNs4($model->ns4); //merge info with current profile $client = $this->di['db']->load('Client', $model->client_id); $email = empty($model->contact_email) ? $client->email : $model->contact_email; $first_name = empty($model->contact_first_name) ? $client->first_name : $model->contact_first_name; $last_name = empty($model->contact_last_name) ? $client->last_name : $model->contact_last_name; $city = empty($model->contact_city) ? $client->city : $model->contact_city; $zip = empty($model->contact_postcode) ? $client->postcode : $model->contact_postcode; $country = empty($model->contact_country) ? $client->country : $model->contact_country; $state = empty($model->contact_state) ? $client->state : $model->contact_state; $phone = empty($model->contact_phone) ? $client->phone : $model->contact_phone; $phone_cc = empty($model->contact_phone_cc) ? $client->phone_cc : $model->contact_phone_cc; $company = empty($model->contact_company) ? $client->company : $model->contact_company; $address1 = empty($model->contact_address1) ? $client->address_1 : $model->contact_address1; $address2 = empty($model->contact_address2) ? $client->address_2 : $model->contact_address2; $birthday = !empty($client->birthday) ? $client->birthday : ''; $company_number = !empty($client->company_number) ? $client->company_number : ''; $contact = new \Registrar_Domain_Contact(); $contact->setEmail($email)->setUsername($email)->setPassword($this->di['tools']->generatePassword(10, 3))->setFirstname($first_name)->setLastname($last_name)->setCity($city)->setZip($zip)->setCountry($country)->setState($state)->setTel($phone)->setTelCC($phone_cc)->setCompany($company)->setCompanyNumber($company_number)->setAddress1($address1)->setAddress2($address2)->setFax($phone)->setFaxCC($phone_cc)->setBirthday($birthday); $d->setContactRegistrar($contact); $d->setContactAdmin($contact); $d->setContactTech($contact); $d->setContactBilling($contact); $d->setTld($model->tld); $d->setSld($model->sld); $d->setRegistrationPeriod($model->period); $d->setEpp($model->transfer_code); if ($model->expires_at) { $d->setExpirationTime(strtotime($model->expires_at)); } return array($d, $adapter); }
/** * 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; }