Ejemplo n.º 1
0
function createdomain($conn, $domainname, $registrant, $admincontact, $techcontact, $billingcontact, $nameservers)
{
    try {
        $domain = new Metaregistrar\EPP\eppDomain($domainname, $registrant);
        $reg = new Metaregistrar\EPP\eppContactHandle($registrant);
        $domain->setRegistrant($reg);
        $admin = new Metaregistrar\EPP\eppContactHandle($admincontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_ADMIN);
        $domain->addContact($admin);
        $tech = new Metaregistrar\EPP\eppContactHandle($techcontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_TECH);
        $domain->addContact($tech);
        $billing = new Metaregistrar\EPP\eppContactHandle($billingcontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_BILLING);
        $domain->addContact($billing);
        $domain->setAuthorisationCode($domain->generateRandomString(12));
        if (is_array($nameservers)) {
            foreach ($nameservers as $nameserver) {
                $host = new Metaregistrar\EPP\eppHost($nameserver);
                $domain->addHost($host);
            }
        }
        $create = new Metaregistrar\EPP\eppLaunchCreateDomainRequest($domain);
        $create->setLaunchPhase('claims', 'application');
        if (($response = $conn->writeandread($create)) instanceof Metaregistrar\EPP\eppLaunchCreateDomainResponse && $response->Success()) {
            /* @var Metaregistrar\EPP\eppLaunchCreateDomainResponse $response */
            echo "Domain " . $response->getDomainName() . " created on " . $response->getDomainCreateDate() . ", expiration date is " . $response->getDomainExpirationDate() . "\n";
            echo "Registration phase: " . $response->getLaunchPhase() . " and Application ID: " . $response->getLaunchApplicationID() . "\n";
        } else {
            var_dump($response);
        }
    } catch (Metaregistrar\EPP\eppException $e) {
        echo $e->getMessage() . "\n";
        return false;
    }
}
 public function testCreateDomainWithoutRegistrant()
 {
     $domain = new \Metaregistrar\EPP\eppDomain($this->randomstring(20) . '.frl');
     $domain->setPeriod(1);
     $domain->setAuthorisationCode('fubar');
     $this->setExpectedException('Metaregistrar\\EPP\\eppException', 'No valid registrant in create domain request');
     new \Metaregistrar\EPP\eppCreateDomainRequest($domain);
 }
 /**
  * Test succesful contact info giving an authcode
  * @throws \Metaregistrar\EPP\eppException
  */
 public function testInfoDomainWithAuthcode()
 {
     $domainname = $this->createDomain();
     $domain = new Metaregistrar\EPP\eppDomain($domainname);
     $domain->setAuthorisationCode('foorbar');
     $info = new Metaregistrar\EPP\eppInfoDomainRequest($domain);
     //$info->dumpContents();
     $response = $this->conn->writeandread($info);
     $this->assertInstanceOf('Metaregistrar\\EPP\\eppInfoDomainResponse', $response);
     /* @var $response Metaregistrar\EPP\eppInfoDomainResponse */
     $this->assertTrue($response->Success());
     $this->assertEquals('Command completed successfully', $response->getResultMessage());
     $this->assertEquals(1000, $response->getResultCode());
 }
Ejemplo n.º 4
0
function transferdomain($conn, $domainname, $authcode)
{
    try {
        $domain = new Metaregistrar\EPP\eppDomain($domainname);
        $domain->setAuthorisationCode($authcode);
        $transfer = new Metaregistrar\EPP\eppTransferRequest(Metaregistrar\EPP\eppTransferRequest::OPERATION_REQUEST, $domain);
        if (($response = $conn->writeandread($transfer)) instanceof Metaregistrar\EPP\eppTransferResponse && $response->Success()) {
            /* @var $response Metaregistrar\EPP\eppTransferResponse */
            echo $response->getDomainName(), " transfer request was succesful\n";
        } else {
            echo "ERROR2\n";
        }
    } catch (Metaregistrar\EPP\eppException $e) {
        echo 'ERROR1';
        echo $e->getMessage() . "\n";
    }
}
Ejemplo n.º 5
0
/**
 * @param Metaregistrar\EPP\eppConnection $conn
 * @param string $domainname
 * @param Metaregistrar\TMCH\tmchClaimData $claim
 * @param string $registrant
 * @param string $admincontact
 * @param string $techcontact
 * @param string $billingcontact
 * @param array $nameservers
 */
function createclaimeddomain($conn, $domainname, $claim, $registrant, $admincontact, $techcontact, $billingcontact, $nameservers)
{
    try {
        $domain = new Metaregistrar\EPP\eppDomain($domainname, $registrant);
        $domain->setPeriod(1);
        $reg = new Metaregistrar\EPP\eppContactHandle($registrant);
        $domain->setRegistrant($reg);
        if ($admincontact) {
            $admin = new Metaregistrar\EPP\eppContactHandle($admincontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_ADMIN);
            $domain->addContact($admin);
        }
        if ($techcontact) {
            $tech = new Metaregistrar\EPP\eppContactHandle($techcontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_TECH);
            $domain->addContact($tech);
        }
        if ($billingcontact) {
            $billing = new Metaregistrar\EPP\eppContactHandle($billingcontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_BILLING);
            $domain->addContact($billing);
        }
        $domain->setAuthorisationCode($domain->generateRandomString(8));
        if (is_array($nameservers)) {
            foreach ($nameservers as $nameserver) {
                $host = new Metaregistrar\EPP\eppHost($nameserver);
                $domain->addHost($host);
            }
        }
        $create = new Metaregistrar\EPP\eppLaunchCreateDomainRequest($domain);
        $create->setLaunchPhase('claims');
        //$create->setLaunchCodeMark($domainname.';'.base64_encode(hash('sha512',$domainname.'MetaregistrarRocks!',true)),'Metaregistrar');
        $create->addLaunchClaim('tmch', $claim['noticeid'], $claim['notafter'], $claim['confirmed']);
        echo $create->saveXML();
        if (($response = $conn->writeandread($create)) instanceof Metaregistrar\EPP\eppLaunchCreateDomainResponse && $response->Success()) {
            /* @var Metaregistrar\EPP\eppLaunchCreateDomainResponse $response */
            echo $response->saveXML();
            echo "Domain " . $response->getDomainName() . " created on " . $response->getDomainCreateDate() . ", expiration date is " . $response->getDomainExpirationDate() . "\n";
            //echo "Registration phase: ".$response->getLaunchPhase()." and Application ID: ".$response->getLaunchApplicationID()."\n";
        }
    } catch (Metaregistrar\EPP\eppException $e) {
        echo $e->getMessage() . "\n";
    }
}
Ejemplo n.º 6
0
 protected function createDomain($domainname = null)
 {
     // If no domain name was given, test with a random .FRL domain name
     if (!$domainname) {
         $domainname = $this->randomstring(20) . '.frl';
     }
     $contactid = $this->createContact();
     $domain = new \Metaregistrar\EPP\eppDomain($domainname);
     $domain->setPeriod(1);
     $domain->setRegistrant($contactid);
     $domain->setAuthorisationCode('fubar');
     $domain->addContact(new \Metaregistrar\EPP\eppContactHandle($contactid, \Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_ADMIN));
     $domain->addContact(new \Metaregistrar\EPP\eppContactHandle($contactid, \Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_TECH));
     $domain->addContact(new \Metaregistrar\EPP\eppContactHandle($contactid, \Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_BILLING));
     $create = new \Metaregistrar\EPP\eppCreateDomainRequest($domain);
     if ($response = $this->conn->request($create)) {
         /* @var $response \Metaregistrar\EPP\eppCreateDomainResponse */
         return $response->getDomainName();
     }
     return null;
 }
Ejemplo n.º 7
0
function createdomain($conn, $domainname, $registrant, $admincontact, $techcontact, $billingcontact, $nameservers)
{
    /* @var $conn Metaregistrar\EPP\eppConnection */
    try {
        $domain = new Metaregistrar\EPP\eppDomain($domainname, $registrant);
        $reg = new Metaregistrar\EPP\eppContactHandle($registrant);
        $domain->setRegistrant($reg);
        $admin = new Metaregistrar\EPP\eppContactHandle($admincontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_ADMIN);
        $domain->addContact($admin);
        $tech = new Metaregistrar\EPP\eppContactHandle($techcontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_TECH);
        $domain->addContact($tech);
        $billing = new Metaregistrar\EPP\eppContactHandle($billingcontact, Metaregistrar\EPP\eppContactHandle::CONTACT_TYPE_BILLING);
        $domain->addContact($billing);
        $domain->setAuthorisationCode('rand0m');
        if (is_array($nameservers)) {
            foreach ($nameservers as $nameserver) {
                $host = new Metaregistrar\EPP\eppHost($nameserver);
                $domain->addHost($host);
            }
        }
        $create = new Metaregistrar\EPP\eppCreateDomainRequest($domain, true);
        if (($response = $conn->writeandread($create)) instanceof Metaregistrar\EPP\eppCreateResponse && $response->Success()) {
            /* @var $response Metaregistrar\EPP\eppCreateResponse */
            echo "Domain " . $response->getDomainName() . " created on " . $response->getDomainCreateDate() . ", expiration date is " . $response->getDomainExpirationDate() . "\n";
        }
    } catch (Metaregistrar\EPP\eppException $e) {
        echo $e->getMessage() . "\n";
    }
}
Ejemplo n.º 8
0
function transferdomain($conn, $domainname, $authcode)
{
    try {
        $domain = new Metaregistrar\EPP\eppDomain($domainname);
        $domain->setAuthorisationCode($authcode);
        $transfer = new Metaregistrar\EPP\eppTransferRequest(Metaregistrar\EPP\eppTransferRequest::OPERATION_REQUEST, $domain);
        echo $transfer->saveXML();
        if (($response = $conn->writeandread($transfer)) instanceof Metaregistrar\EPP\eppTransferResponse && $response->Success()) {
            echo $response->saveXML();
        }
    } catch (Metaregistrar\EPP\eppException $e) {
        echo $e->getMessage() . "\n";
    }
}