当前位置: 首页>>代码示例>>PHP>>正文


PHP Registry::UpdateDomainNameservers方法代码示例

本文整理汇总了PHP中Registry::UpdateDomainNameservers方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::UpdateDomainNameservers方法的具体用法?PHP Registry::UpdateDomainNameservers怎么用?PHP Registry::UpdateDomainNameservers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Registry的用法示例。


在下文中一共展示了Registry::UpdateDomainNameservers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rand

 function _testOnlineNIC()
 {
     $Registrant = $this->Registry->NewContactInstance(CONTACT_TYPE::REGISTRANT);
     $Registrant->SetFieldList($this->contact_data);
     $Registrant->AuthCode = rand(100000, 999999);
     $this->Registry->CreateContact($Registrant);
     $this->assertTrue($Registrant->CLID != null, 'Create registrant contact');
     $Contact = $this->Registry->NewContactInstanceByGroup('generic');
     $Contact->SetFieldList(array_merge($this->contact_data, array('cc' => 'US', 'AppPurpose' => 'P1', 'NexusCategory' => 'C12')));
     $Contact->AuthCode = rand(100000, 999999);
     $this->Registry->CreateContact($Contact);
     $this->assertTrue($Contact->CLID != null, 'Create generic contact');
     $Domain = $this->Registry->NewDomainInstance();
     $Domain->Name = 'webta' . rand(1000, 9999);
     $this->assertTrue($this->Registry->DomainCanBeRegistered($Domain), 'Domain available for registration');
     $Domain->SetNameserverList(array(new Nameserver('ns1.onlinenic.com'), new Nameserver('ns2.onlinenic.com')));
     $Domain->SetContact($Registrant, CONTACT_TYPE::REGISTRANT);
     $Domain->SetContact($Contact, CONTACT_TYPE::TECH);
     $Domain->SetContact($Contact, CONTACT_TYPE::BILLING);
     $Domain->SetContact($Contact, CONTACT_TYPE::ADMIN);
     $Domain->AuthCode = rand(10000000, 99999999);
     $this->Registry->CreateDomain($Domain, 2);
     $this->assertTrue($Domain->ID != null && $Domain->Status == DOMAIN_STATUS::DELEGATED, 'Create domain');
     $contact_data = $Contact->GetFieldList();
     $contact_data['name'] = 'Nerrible man';
     $Contact->SetFieldList($contact_data);
     $Contact->ExtraData['type'] = CONTACT_TYPE::TECH;
     $Contact->ExtraData['domainname'] = $Domain->Name;
     $this->Registry->UpdateContact($Contact);
     $this->assertTrue(true, 'Update contact');
     $old_expire_date = $Domain->ExpireDate;
     $this->Registry->RenewDomain($Domain, array('period' => 1));
     $this->assertTrue($Domain->ExpireDate !== $old_expire_date, 'Renew domain');
     $nslist = $Domain->GetNameserverList();
     $changelist = $Domain->GetNameserverChangelist();
     $changelist->SetChangedList(array(new Nameserver('ns1.google.com'), new Nameserver('ns2.google.com')));
     $this->Registry->UpdateDomainNameservers($Domain, $changelist);
     $this->assertTrue($Domain->GetNameserverList() == $changelist->GetList(), 'Update domain nameservers');
     $Domain2 = $this->Registry->NewDomainInstance();
     $Domain2->Name = $Domain->Name;
     $Domain2 = $this->Registry->GetRemoteDomain($Domain2);
     $this->assertTrue($Domain2->ExpireDate == $Domain->ExpireDate, 'Get remote domain');
     $nshost = new NameserverHost("ns1.{$Domain->GetHostName()}", '70.84.45.21');
     $this->Registry->CreateNameserverHost($nshost);
     $nshost->IPAddr = '70.84.45.23';
     $this->Registry->GetModule()->UpdateNameserverHost($nshost);
     $ok = $this->Registry->DeleteNameserverHost($nshost);
     $this->assertTrue($ok, 'Delete nameserver host');
     $ok = $this->Registry->DeleteDomain($Domain);
     $this->assertTrue($ok, 'Delete domain');
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:51,代码来源:tests.php

示例2: OnDomainCreated

		public function OnDomainCreated (Domain $Domain)
		{
			if ($this->once_run)
			{
				return;
			}
			
			$this->once_run = true;
	
	       	////
			// 3. CREATE 2 child name servers of newly created domain
			//
			try
			{
				$ns1 = new NameserverHost('ns1.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
				$ns2 = new NameserverHost('ns2.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
				
				$this->Registry->CreateNameserverHost($ns1);
				$this->Registry->CreateNameserverHost($ns2);
				
				$this->TestCase->assertTrue(true, 'Create nameservers');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Create nameservers. Error: ' . $e->getMessage());
			}
				
				
			////
			// 4. UPDATE Domain to attach child name servers to domain
			//
				
			try
			{
				$nslist = $Domain->GetNameserverChangelist();
				$nslist->Add($ns1);
				$nslist->Add($ns2);
				
				$this->Registry->UpdateDomainNameservers($Domain, $nslist);
				
				$this->TestCase->assertTrue(
					count($Domain->GetNameserverList()) == 4,
					'Attach nameservers to domain'
				);
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Attach nameservers to domain. Error: ' . $e->getMessage());
			}
				
			////
			// Create tech contact
			// 
			try
			{
				$Tech = $this->Registry->NewContactInstance(CONTACT_TYPE::TECH);
				$Tech->SetFieldList($this->contact_fields);
				
				$this->Registry->CreateContact($Tech);
				
				$this->TestCase->assertTrue(true, 'Create another contact');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Create another contact. Error: ' . $e->getMessage());
			}
				
			////
			// Update domain contact
			try
			{
				$this->Registry->UpdateDomainContact($Domain, CONTACT_TYPE::TECH, null, $Tech);
				
				$this->TestCase->assertTrue(true, 'Attach contact to domain');
			}	
			catch (Exception $e)
			{
				return $this->TestCase->fail('Attach contact to domain. Error: ' . $e->getMessage());
			}
			
	
			////
			// 6. Perform an INFO command on the domain to verify update
			//
				
			try
			{
				$RDomain = $this->Registry->NewDomainInstance();
				$RDomain->Name = $Domain->Name;
				
				$RDomain = $this->Registry->GetRemoteDomain($RDomain);
				
				
				$this->TestCase->assertTrue(
					$RDomain->Name == $Domain->Name &&
					date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) &&
					date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) &&
					count($RDomain->GetNameserverList()) == count($Domain->GetNameserverList()) &&
					$RDomain->GetContact(CONTACT_TYPE::TECH)->CLID == $Tech->CLID,
					'Get remote domain'
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:tests.php

示例3: testEPP

 function testEPP()
 {
     $Domain = $this->Registry->NewDomainInstance();
     $Domain->Name = 'webta' . rand(1000, 9999);
     // check domain
     try {
         $ok = $this->Registry->DomainCanBeRegistered($Domain)->Result;
         $this->assertTrue($ok, 'Domain available for registration');
     } catch (Exception $e) {
         return $this->fail('Domain available for registration. Error: ' . $e->getMessage());
     }
     ////
     // Create contact
     try {
         $Registrant = $this->Registry->NewContactInstanceByGroup('generic');
         $Registrant->SetFieldList($this->contact_fields);
         $this->Registry->CreateContact($Registrant);
         $this->assertTrue(true, 'Create contact');
     } catch (Exception $e) {
         return $this->fail('Create contact. Error: ' . $e->getMessage());
     }
     ////
     // Get contact INFO
     try {
         $RRegistrant = $this->Registry->NewContactInstanceByGroup('generic');
         $RRegistrant->CLID = $Registrant->CLID;
         $this->Registry->GetRemoteContact($RRegistrant);
         $fields = $Registrant->GetFieldList();
         $rfields = $RRegistrant->GetFieldList();
         ksort($fields);
         ksort($rfields);
         $discloses = $Registrant->GetDiscloseList();
         $rdiscloses = $RRegistrant->GetDiscloseList();
         ksort($discloses);
         ksort($rdiscloses);
         $this->assertTrue($fields['name'] == $rfields['name'] && $fields['email'] == $rfields['email'] && $fields['voice'] == $rfields['voice'] && $discloses == $rdiscloses, 'Get remote contact');
     } catch (Exception $e) {
         return $this->fail('Get remote contact. Error: ' . $e->getMessage());
     }
     try {
         $Domain->SetContact($Registrant, CONTACT_TYPE::REGISTRANT);
         $this->Registry->CreateDomain($Domain, 2);
         $this->assertTrue(true, 'Create domain');
     } catch (Exception $e) {
         return $this->fail('Create domain. Error: ' . $e->getMessage());
     }
     ////
     // 3. CREATE 2 child name servers of newly created domain
     //
     try {
         $ns1 = new NameserverHost('ns1.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
         $ns2 = new NameserverHost('ns2.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
         $ns3 = new NameserverHost('ns3.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
         $this->Registry->CreateNameserverHost($ns1);
         $this->Registry->CreateNameserverHost($ns2);
         $this->Registry->CreateNameserverHost($ns3);
         $this->assertTrue(true, 'Create nameservers');
     } catch (Exception $e) {
         return $this->fail('Create nameservers. Error: ' . $e->getMessage());
     }
     ////
     // 4. UPDATE Domain to attach child name servers to domain
     //
     try {
         $nslist = $Domain->GetNameserverChangelist();
         $nslist->Add($ns1);
         $nslist->Add($ns2);
         $nslist->Add($ns3);
         $this->Registry->UpdateDomainNameservers($Domain, $nslist);
         $this->assertTrue(count($Domain->GetNameserverList()) == 3, 'Attach nameservers to domain');
     } catch (Exception $e) {
         return $this->fail('Attach nameservers to domain. Error: ' . $e->getMessage());
     }
     ////
     // 5. UPDATE Domain�s status to
     // clientHold, clientUpdateProhibited, clientDeleteProhibited, and clientTransferProhibited
     // within one command
     try {
         $flag_list = $Domain->GetFlagChangelist();
         $flag_list->SetChangedList(array('clientUpdateProhibited', 'clientDeleteProhibited', 'clientTransferProhibited'));
         $this->Registry->UpdateDomainFlags($Domain, $flag_list);
         $this->assertTrue(count($Domain->GetFlagList()) == count($flag_list->GetList()), 'Update domain status');
     } catch (Exception $e) {
         return $this->fail('Update domain status. Error: ' . $e->getMessage());
     }
     ////
     // 6. Perform an INFO command on the domain to verify update
     //
     try {
         $RDomain = $this->Registry->NewDomainInstance();
         $RDomain->Name = $Domain->Name;
         $RDomain = $this->Registry->GetRemoteDomain($RDomain);
         $flags = $Domain->GetFlagList();
         $rflags = $RDomain->GetFlagList();
         sort($flags);
         sort($rflags);
         $this->assertTrue($RDomain->Name == $Domain->Name && date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) && $rflags == $flags, 'Get remote domain');
     } catch (Exception $e) {
         return $this->fail('Get remote domain. Error: ' . $e->getMessage());
     }
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:tests.php

示例4: Run

 public function Run()
 {
     $DbDomain = DBDomain::GetInstance();
     $DbNameserverHost = DBNameserverHost::GetInstance();
     // Cleanup previous execution traces
     try {
         $this->Module->Request("domain-delete", array("name" => "testeppart.kz"));
     } catch (Exception $e) {
     }
     try {
         $Domain = $DbDomain->LoadByName('testeppart', 'kz');
         $this->Registry->DeleteDomain($Domain);
     } catch (Exception $e) {
     }
     try {
         $this->Module->Request("domain-delete", array("name" => "newtesteppart.kz"));
     } catch (Exception $e) {
     }
     try {
         $Domain = $DbDomain->LoadByName('newtesteppart', 'kz');
         $this->Registry->DeleteDomain($Domain);
     } catch (Exception $e) {
     }
     //
     // 1. Create domain
     //
     $Contact = $this->Registry->NewContactInstance(CONTACT_TYPE::REGISTRANT);
     $Contact->SetFieldList($this->contact_fields);
     $this->Registry->CreateContact($Contact);
     $Domain = $this->Registry->NewDomainInstance();
     $Domain->UserID = 39;
     $Domain->Name = 'testeppart';
     $Domain->Period = 1;
     $Domain->SetContact($Contact, CONTACT_TYPE::REGISTRANT);
     $Domain->SetContact($Contact, CONTACT_TYPE::ADMIN);
     $Domain->SetContact($Contact, CONTACT_TYPE::TECH);
     $Domain->SetContact($Contact, CONTACT_TYPE::BILLING);
     $this->Registry->CreateDomain($Domain, $Domain->Period);
     $NS1 = new NameserverHost('ns1.testeppart.kz', '212.110.212.110');
     $this->Registry->CreateNameserver($NS1);
     $NS2 = new NameserverHost('ns2.testeppart.kz', '212.110.111.111');
     $this->Registry->CreateNameserver($NS2);
     $Changelist = $Domain->GetNameserverChangelist();
     $Changelist->Add($NS1);
     $Changelist->Add($NS2);
     $this->Registry->UpdateDomainNameservers($Domain, $Changelist);
     $this->AssertTrue(date('Ymd', $Domain->ExpireDate) == date('Ymd', strtotime('+1 year')) && count($Domain->GetNameserverList()) == 2, 'Create domain');
     // Reload domain from Db for correct operations
     $Domain = $DbDomain->LoadByName('testeppart', 'kz');
     $DbNameserverHost->LoadList($Domain->ID);
     //
     // 2. Update nameserver host
     //
     $nslist = $Domain->GetNameserverList();
     $NS2 = $nslist[1];
     $NS2->IPAddr = '212.111.110.110';
     $this->Registry->UpdateNameserverHost($NS2);
     $this->assertTrue(true, 'Update nameserver host');
     //
     // 3. Create nameserver host
     //
     $Domain4Host = $this->Registry->NewDomainInstance();
     $Domain4Host->UserID = 39;
     $Domain4Host->Name = 'newtesteppart';
     $Domain4Host->Period = 1;
     $Domain4Host->SetContact($Contact, CONTACT_TYPE::REGISTRANT);
     $this->Registry->CreateDomain($Domain4Host, $Domain4Host->Period);
     $NS3 = new NameserverHost('ns.newtesteppart.kz', '211.211.211.211');
     $this->Registry->CreateNameserverHost($NS3);
     $this->assertTrue(true, 'Create nameserver host');
     //
     // 4. Add nameserver to domain
     //
     $Changelist = $Domain->GetNameserverChangelist();
     $Changelist->Add($NS3);
     $this->Registry->UpdateDomainNameservers($Domain, $Changelist);
     $this->assertTrue(count($Domain->GetNameserverList()) == 3, 'Add nameserver to domain');
     //
     // 5. Remove nameserver from domain
     //
     $nslist = $Domain->GetNameserverList();
     $NS1 = $nslist[0];
     $Changelist = $Domain->GetNameserverChangelist();
     $Changelist->Remove($NS1);
     $this->Registry->UpdateDomainNameservers($Domain, $Changelist);
     $this->assertTrue(count($Domain->GetNameserverList()) == 2, 'Remove nameserver from domain');
     //
     // 6. Delete nameserver host
     //
     try {
         $this->Registry->DeleteNameserverHost($NS1);
         $this->assertTrue(true, 'Delete nameserver host');
     } catch (Exception $e) {
         $this->assertTrue(true, 'Delete nameserver host failed. Don\'t forget to cheat response code');
     }
     //
     // 7. Update contact
     //
     $contact_fields = $Contact->GetFieldList();
     $contact_fields['voice'] = '+380-555-7654321';
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:class.RegistryModule.php

示例5: RunTest

 /**
  * Enter description here...
  */
 public function RunTest(DataForm $DF)
 {
     $filename = '/tmp/eppdrs-verisign-certtest-' . date('YmdHis') . '.log';
     Log::RegisterLogger("File", "Verisign", $filename);
     Log::SetDefaultLogger("Verisign");
     // Build dataforms for modules
     $DF1 = self::GetConfigurationForm();
     $DF1->GetFieldByName('Login')->Value = $DF->GetFieldByName('Login_1')->Value;
     $DF1->GetFieldByName('Password')->Value = $DF->GetFieldByName('Password_1')->Value;
     $DF1->GetFieldByName('ServerHost')->Value = $DF->GetFieldByName('ServerHost')->Value;
     $DF1->GetFieldByName('ServerPort')->Value = $DF->GetFieldByName('ServerPort')->Value;
     $DF1->GetFieldByName('SSLCertPath')->Value = $DF->GetFieldByName('SSLCertPath')->Value;
     $DF1->GetFieldByName('SSLCertPass')->Value = $DF->GetFieldByName('SSLCertPass')->Value;
     $DF2 = self::GetConfigurationForm();
     $DF2->GetFieldByName('Login')->Value = $DF->GetFieldByName('Login_2')->Value;
     $DF2->GetFieldByName('Password')->Value = $DF->GetFieldByName('Password_2')->Value;
     $DF2->GetFieldByName('ServerHost')->Value = $DF->GetFieldByName('ServerHost')->Value;
     $DF2->GetFieldByName('ServerPort')->Value = $DF->GetFieldByName('ServerPort')->Value;
     $DF2->GetFieldByName('SSLCertPath')->Value = $DF->GetFieldByName('SSLCertPath')->Value;
     $DF2->GetFieldByName('SSLCertPass')->Value = $DF->GetFieldByName('SSLCertPass')->Value;
     // Initialize modules
     $Module = new VerisignRegistryModule(new RegistryManifest(MODULES_PATH . "/registries/Verisign/module.xml"));
     $Module->InitializeModule('com', $DF1);
     $Registry = new Registry($Module);
     $Module2 = new VerisignRegistryModule(new RegistryManifest(MODULES_PATH . "/registries/Verisign/module.xml"));
     $Module2->InitializeModule('com', $DF2);
     $Registry2 = new Registry($Module2);
     // The subject domain
     $Domain = $this->RegistryAccessible->NewDomainInstance();
     $Domain->Name = 'webta' . rand(1000, 9999);
     $Domain->UserID = 1;
     ////
     // 1. Using your OT&E1 account perform a CHECK command on domain name(s) until you
     // receive domain available response
     $oplog = array();
     $op = array('title' => 'Perform a CHECK command on domain name(s)');
     try {
         $ok = $Registry->DomainCanBeRegistered($Domain)->Result;
         $op['ok'] = (bool) $ok;
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 2. CREATE the Domain name using the CREATE command, term of registration should be
     // 2 years
     $op = array('title' => "CREATE the Domain name using the CREATE command");
     try {
         $Contact = $Registry->NewContactInstanceByGroup('generic');
         $Domain->SetContact($Contact, CONTACT_TYPE::REGISTRANT);
         $Domain->SetContact($Contact, CONTACT_TYPE::BILLING);
         $Domain->SetContact($Contact, CONTACT_TYPE::TECH);
         $Domain->SetContact($Contact, CONTACT_TYPE::ADMIN);
         $Registry->CreateDomain($Domain, 2);
         $op['ok'] = true;
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 3. CREATE 2 child name servers of newly created domain
     //
     $op = array('title' => "CREATE 2 child name servers of newly created domain");
     try {
         $ns1 = new NameserverHost('ns1.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
         $ns2 = new NameserverHost('ns2.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
         $Registry->CreateNameserverHost($ns1);
         $Registry->CreateNameserverHost($ns2);
         $op['ok'] = true;
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 4. UPDATE Domain to attach child name servers to domain
     //
     $op = array('title' => "UPDATE Domain to attach child name servers to domain");
     try {
         $nslist = $Domain->GetNameserverChangelist();
         $nslist->Add($ns1);
         $nslist->Add($ns2);
         $Registry->UpdateDomainNameservers($Domain, $nslist);
         $op['ok'] = count($Domain->GetNameserverList()) == 2;
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 5. UPDATE Domain's status to
     // clientHold, clientUpdateProhibited, clientDeleteProhibited, and clientTransferProhibited
     // within one command
     $op = array('title' => "UPDATE Domain's status");
     try {
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:class.RegistryModule.php


注:本文中的Registry::UpdateDomainNameservers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。