Esempio n. 1
0
 /**
  * Tests the class factory
  */
 public function testCreateInterface()
 {
     $conn = Metaregistrar\EPP\eppConnection::create('./testsetup.ini');
     $this->assertInstanceOf('Metaregistrar\\EPP\\metaregEppConnection', $conn);
     /* @var $conn Metaregistrar\EPP\metaregEppConnection */
     $this->assertEquals($conn->getHostname(), 'ssl://epp.test2.metaregistrar.com');
     $this->assertEquals($conn->getPort(), 7443);
 }
Esempio n. 2
0
 /**
  * Gets information on a contact handle
  * @param $contacthandle
  * @return \Metaregistrar\EPP\eppInfoContactResponse|\Metaregistrar\EPP\eppResponse
  * @throws \Metaregistrar\EPP\eppException
  */
 protected function getContactInfo($contacthandle)
 {
     $epp = new Metaregistrar\EPP\eppContactHandle($contacthandle);
     $info = new Metaregistrar\EPP\eppInfoContactRequest($epp);
     if (($response = $this->conn->writeandread($info)) instanceof Metaregistrar\EPP\eppInfoContactResponse && $response->Success()) {
         /* @var $response Metaregistrar\EPP\eppInfoContactResponse */
         return $response;
     }
     return null;
 }
/**
 * @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";
    }
}
 public function testCreateInterfaceNoParam()
 {
     $this->setExpectedException('Metaregistrar\\EPP\\eppException', 'Configuration file not specified on eppConnection:create');
     Metaregistrar\EPP\eppConnection::create(null);
 }
Esempio n. 5
0
/**
 * @param Metaregistrar\EPP\eppConnection $conn
 * @param string $domainname
 * @param string $authcode
 */
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()) {
            echo $response->saveXML();
        }
    } catch (Metaregistrar\EPP\eppException $e) {
        echo $e->getMessage() . "\n";
    }
}