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


PHP Registry::NewContactInstanceByGroup方法代码示例

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


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

 function testModule()
 {
     $Contact = $this->Registry->NewContactInstanceByGroup('generic');
     $Contact->SetFieldList(array("firstname" => "Marat", "lastname" => "Komarov", "org" => "Webta", "street1" => "Testing str. 80", "street2" => "Drive 54", "city" => "Testing", "pc" => "90210", "cc" => "US", "sp" => "TX", "voice" => "+33-312-34567", "fax" => "+33-312-34567", "email" => "marat@webta.net"));
     $this->Registry->CreateContact($Contact);
     $Contact2 = $this->Registry->NewContactInstanceByGroup('generic');
     $Contact2->SetFieldList(array("firstname" => "Marat", "lastname" => "Komarov", "org" => "Webta", "street1" => "Testing str. 80", "street2" => "Drive 54", "city" => "Testing", "pc" => "90210", "cc" => "US", "sp" => "TX", "voice" => "+333.1234567", "fax" => "+333.1234567", "email" => "marat@webta.net"));
     $this->Registry->CreateContact($Contact2);
     $Domain = $this->Registry->NewDomainInstance();
     $Domain->Name = 'webta' . rand(100, 999);
     $Domain->SetContact($Contact, CONTACT_TYPE::REGISTRANT);
     $Domain->SetContact($Contact2, CONTACT_TYPE::TECH);
     $period = 1;
     $this->Registry->CreateDomain($Domain, $period);
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:15,代码来源:tests.php

示例3: Run

		public function Run ()
		{
			////
			// 1. Login (will be done automatical in next command)

			
			////
			// 2. Poll. Get transfer auth code
			$Resp = $this->Module->Request('poll-request', array());
			$this->AssertTrue($Resp->Succeed, 'Login');
			
			if ($Resp->Code == RFC3730_RESULT_CODE::OK_ACK_DEQUEUE)
			{
				$msgID = (string)$Resp->Data->response->msgQ->attributes()->id;
				
				$infData = $Resp->Data->response->resData->children('urn:ietf:params:xml:ns:domain-1.0');
				$infData = $infData[0];
				
				$auth_code = (string)$infData->authInfo->pw;
			}
			else
			{
				$auth_code = 'my&p$w#d22.';				
			}
			$this->AssertTrue(isset($msgID, $auth_code), 'Poll');

			////
			// 3. Request transfer

			$Domain = $this->Registry->NewDomainInstance();
			$Domain->Name = "{$this->clID}-domain-1";
			$Resp = $this->Module->TransferRequest($Domain, array('pw' => $auth_code));
			$this->AssertTrue($Resp->Code == RFC3730_RESULT_CODE::OK, 'Transfer domain 1');
		
			
			////
			// 4. Acknowledge message
			
			$Resp = $this->Module->Request('poll-ack', array('msgID' => $msgID));
			$this->AssertTrue($Resp->Code == RFC3730_RESULT_CODE::OK, 'Acknowledge message');

						
			////
			// 5. Check contact 1
			
			$Contact1 = $this->Registry->NewContactInstanceByGroup('generic');
			$Contact1->CLID = strtoupper($this->clID)."-1";
			$ok = $this->Registry->ContactCanBeCreated($Contact1);
			$this->AssertTrue($ok, 'Check contact 1');

		
			////
			// 6. Create contact 1
			
			$contact_data = array(
				'name' => 'Firstname Lastname',
				'org' => 'Organisation',
				'street1' => 'Testdivision',
				'street2' => 'Teststrasse 999',
				'city' => 'Bern',
				'pc' => '3001',
				'cc' => 'CH',
				'voice' => '+41-335-555555',
				'email' => 'test1@yourdomain.ch'
			);
			$Contact1->SetFieldList($contact_data);
			$Resp = $this->Module->CreateContact($Contact1);
			$this->AssertTrue($Resp->Code == RFC3730_RESULT_CODE::OK, 'Create contact 1');
			$Contact1->CLID = $Resp->CLID;

			
			////
			// 7. Create name server 1
			
			$NS3 = new NameserverHost('ns3.' . $Domain->GetHostName(), '240.1.1.1');
			$Resp = $this->Module->CreateNameserverHost($NS3);
			$this->AssertTrue($Resp->Code == RFC3730_RESULT_CODE::OK, 'Create name server 1');
			
			////
			// 8. Info domain 1
			
			$GrdResp = $this->Module->GetRemoteDomain($Domain);
			$this->AssertTrue($GrdResp->TechContact, 'Info domain 1');
			

			////
			// 9. Info Tech-Contact
			
			$Tech = $this->Registry->NewContactInstanceByGroup('generic');
			$Tech->CLID = $GrdResp->TechContact;
			$Resp = $this->Module->GetRemoteContact($Tech);
			$this->AssertTrue($Resp->Code == RFC3730_RESULT_CODE::OK, 'Info Tech-Contact');
			
			////
			// 10. Update domain 1 (complete transfer)
			
			$add = '<domain:add>';
			$add .= '<domain:ns><domain:hostObj>'.$NS3->HostName.'</domain:hostObj></domain:ns>';
			$add .= '<domain:contact type="tech">'.$Contact1->CLID.'</domain:contact>';
			$add .= '</domain:add>';
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:class.RegistryModule.php

示例4: RunTest

 public function RunTest(DataForm $DF)
 {
     $filename = '/tmp/eppdrs-srsplus-certtest-' . date('YmdHis') . '.log';
     Log::RegisterLogger("File", "SRSPLUS", $filename);
     Log::SetDefaultLogger("SRSPLUS");
     $fields = $DF->ListFields();
     $conf_fields = $this->Config->ListFields();
     $conf_fields['Login']->Value = $fields['Login']->Value;
     $conf_fields['Email']->Value = $fields['Email']->Value;
     $conf_fields['Host']->Value = $fields['Host']->Value;
     $conf_fields['GPGPass']->Value = $fields['GPGPass']->Value;
     $conf_fields['TestMode']->Value = '1';
     $Module = new SRSPlusRegistryModule(new RegistryManifest(MODULES_PATH . "/registries/SRSPlus/module.xml"));
     $Module->InitializeModule('com', $this->Config);
     $Registry = new Registry($Module);
     $oplog = array();
     ////
     // 1. Create contact
     $op = array('title' => "Create contact");
     try {
         $Contact = $Registry->NewContactInstanceByGroup('generic');
         $Contact->SetFieldList(array("firstname" => "Marat", "lastname" => "Komarov", "org" => "Webta", "street1" => "Testing str. 80", "street2" => "Drive 54", "city" => "Testing", "pc" => "90210", "cc" => "US", "sp" => "TX", "voice" => "+333.1234567", "fax" => "+333.1234567", "email" => "marat@webta.net"));
         $Registry->CreateContact($Contact);
         $Contact2 = $Registry->NewContactInstanceByGroup('generic');
         $Contact2->SetFieldList(array("firstname" => "Marat", "lastname" => "Komarov", "org" => "Webta", "street1" => "Testing str. 80", "street2" => "Drive 54", "city" => "Testing", "pc" => "90210", "cc" => "US", "sp" => "TX", "voice" => "+333.1234567", "fax" => "+333.1234567", "email" => "marat@webta.net"));
         $Registry->CreateContact($Contact2);
         $op['ok'] = true;
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 2. Get remote contact
     $op = array('title' => 'Get contact');
     try {
         $RContact = $Registry->NewContactInstanceByGroup('generic');
         $RContact->CLID = $Contact->CLID;
         $RContact = $Registry->GetRemoteContact($Contact);
         $contact_fields = $Contact->GetFieldList();
         $rcontact_fields = $RContact->GetFieldList();
         $op['ok'] = $contact_fields['first_name'] == $rcontact_fields['first_name'] && $contact_fields['last_name'] == $rcontact_fields['last_name'];
         if (!$op['ok']) {
             $op['fail_reason'] = 'Invalid module behavoiur';
         }
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 3. Update contact
     $op = array('title' => 'Edit contact');
     try {
         $contact_fields['email'] = 'pupkin-vasiliy@mail.ru';
         $contact_fields['voice'] = '+554.233456';
         $Contact->SetFieldList($contact_fields);
         $Registry->UpdateContact($Contact);
         $op['ok'] = true;
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 4. Create domain
     $op = array('title' => 'Create domain');
     try {
         $Domain = $Registry->NewDomainInstance();
         $Domain->Name = 'webta' . rand(100, 999);
         $Domain->SetContact($Contact, CONTACT_TYPE::REGISTRANT);
         $Domain->SetContact($Contact2, CONTACT_TYPE::TECH);
         $period = 1;
         $Registry->CreateDomain($Domain, $period);
         $op['ok'] = true;
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 5. Get remote domain
     $op = array('title' => 'Whois');
     try {
         $RDomain = $Registry->NewDomainInstance();
         $RDomain->Name = $Domain->Name;
         $RDomain = $Registry->GetRemoteDomain($RDomain);
         $op['ok'] = date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate);
         if (!$ok) {
             $op['fail_reason'] = 'Invalid module behavoiur';
         }
     } catch (Exception $e) {
         $op['ok'] = false;
         $op['fail_reason'] = $e->getMessage();
     }
     $oplog[] = $op;
     ////
     // 6. Renew domain
     $op = array('title' => 'Renew domain');
     try {
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:class.RegistryModule.php

示例5: 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

示例6: queryInfoContact

 function queryInfoContact()
 {
     $Contact = $this->Registry->NewContactInstanceByGroup("generic");
     $Contact->CLID = 'EPPOTE-C6';
     $Resp = $this->Module->GetRemoteContact($Contact);
     $this->assertTrue($Resp->Code == RFC3730_RESULT_CODE::OK && $Resp->CLID == 'EPPOTE-C6' && $Resp->name == 'John Doe', "Query Contact");
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:7,代码来源:class.RegistryModule.php

示例7: changeDomainOwner

 function changeDomainOwner()
 {
     $title = "Change domain owner";
     try {
         $Contact = $this->Registry->NewContactInstanceByGroup("registrant");
         $Contact->SetFieldList(array('name' => 'Kim Gordon', 'org' => 'Sonic', 'cc' => 'NO', 'sp' => 'Crimea', 'city' => 'TRONDHEIM', 'pc' => '7491', 'sp' => 'Crimea', 'street1' => 'absdcdc', 'street2' => '', 'voice' => '+33.12345678', 'fax' => '+33.12345678', 'email' => 'kim@gordon' . rand(10, 99) . '.net', 'vatno' => 'UA' . rand(1000, 9999), 'orgno' => '[UA]' . rand(1000, 9999)));
         $this->Module->CreateContact($Contact);
         $Resp = $this->Module->Request('domain-update-contact', array('name' => "{$this->Prefix}-05.se", 'add' => '', 'rem' => '', 'change' => "<domain:chg><domain:registrant>{$Contact->CLID}</domain:registrant></domain:chg>"));
         $Resp = $this->Module->Request('domain-info', array('name' => "{$this->Prefix}-05.se"));
         $this->assertTrue($Resp->Code == 1000, $title);
     } catch (RegistryException $e) {
         $this->fail($title);
     }
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:14,代码来源:class.RegistryModule.php


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