/** * @param eppConnection $conn * @param string $domainname * @param string $registrant * @param string $admincontact * @param string $techcontact * @param string $billingcontact * @param array $nameservers */ function createdomain($conn, $domainname, $registrant, $admincontact, $techcontact, $billingcontact, $nameservers) { /* @var $conn Metaregistrar\EPP\eppConnection */ try { $domain = new eppDomain($domainname, $registrant); $domain->setPeriod(2); $domain->setRegistrant(new eppContactHandle($registrant)); if ($admincontact) { $domain->addContact(new eppContactHandle($admincontact, eppContactHandle::CONTACT_TYPE_ADMIN)); } if ($techcontact) { $domain->addContact(new eppContactHandle($techcontact, eppContactHandle::CONTACT_TYPE_TECH)); } if ($billingcontact) { $domain->addContact(new eppContactHandle($billingcontact, eppContactHandle::CONTACT_TYPE_BILLING)); } $domain->setAuthorisationCode('rand0m'); if (is_array($nameservers)) { foreach ($nameservers as $nameserver) { $domain->addHost(new eppHost($nameserver)); } } $create = new eppCreateDomainRequest($domain, false, false); $create->dumpContents(); if ($response = $conn->request($create)) { /* @var $response Metaregistrar\EPP\eppCreateDomainResponse */ echo "Domain " . $response->getDomainName() . " created on " . $response->getDomainCreateDate() . ", expiration date is " . $response->getDomainExpirationDate() . "\n"; } } catch (eppException $e) { echo $e->getMessage() . "\n"; } }