本文整理汇总了PHP中Registry::GetModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::GetModule方法的具体用法?PHP Registry::GetModule怎么用?PHP Registry::GetModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::GetModule方法的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');
}
示例2: testBusy
function testBusy ()
{
$PollMessage = new PollTransferResponse(REGISTRY_RESPONSE_STATUS::SUCCESS);
$PollMessage->HostName = 'buerex.ch';
$PollMessage->TransferStatus = TRANSFER_STATUS::APPROVED;
$this->registry->DispatchPollTransfer($PollMessage);
return;
// Fucked up domain.
$Domain = $this->registry->NewDomainInstance();
$Domain->Name = 'rest-rosengarten';
$Domain->AuthCode = '%mQGtyNk6';
$Domain->SetNameserverList(array(
new Nameserver('ns1.setup.ch'),
new Nameserver('ns2.setup.ch'),
new Nameserver('ns3.setup.ch')
));
$Contact = $this->registry->NewContactInstance(CONTACT_TYPE::REGISTRANT);
$Contact->CLID = 'N74158532';
$Domain->SetContact($Contact, CONTACT_TYPE::REGISTRANT);
$Contact = $this->registry->NewContactInstance(CONTACT_TYPE::REGISTRANT);
$Contact->CLID = 'L22589790';
$Domain->SetContact($Contact, CONTACT_TYPE::TECH);
$Module = $this->registry->GetModule();
$Resp = $Module->CreateDomain($Domain, 1);
print_r($Resp);
return;
/*
$Module->Request('domain-update-contact', array(
'name' => 'wellnessbad.ch',
'add' => '<domain:add><domain:contact type="tech">L22589790</domain:contact></domain:add>',
'rem' => '<domain:rem><domain:contact type="tech">11934643</domain:contact></domain:rem>',
'change' => ''
));
*/
//$Contact = $this->registry->NewContactInstance(CONTACT_TYPE::REGISTRANT);
//$Contact->CLID = 'L22589790';
//$this->registry->GetRemoteContact($Contact);
//$DbContact->Save($Contact);
}
示例3: OnDomainCreated
//.........这里部分代码省略.........
// 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'
);
}
catch (Exception $e)
{
return $this->TestCase->fail('Get remote domain. Error: ' . $e->getMessage());
}
////
// 10. UPDATE one of the name server’s IP Address
//
try
{
$ns1->IPAddr = gethostbyname('ns.hostdad.com');
$Resp = $this->Registry->GetModule()->UpdateNameserverHost($ns1);
$this->TestCase->assertTrue($Resp->Result, 'Update domain nameserver');
}
catch (Exception $e)
{
return $this->TestCase->fail('Update domain nameserver. Error: ' . $e->getMessage());
}
////
// 12. Renew Domain for 2 years
//
/*
try
{
$this->Registry->RenewDomain($Domain, $extra=array('period' => 2));
$this->TestCase->assertFalse(true, 'Domain renewal. Exception expected');
}
catch (Exception $e)
{
$this->TestCase->assertTrue($e->getMessage() == 'A domain can not be renewed earlier that 365 days from its expiration', 'Domain renewal');
}
*/
// secondary registry
$DataForm = new DataForm();
$DataForm->AppendField( new DataFormField("ServerHost", FORM_FIELD_TYPE::TEXT, null, null, null, null, 'https://devepp.ics.forth.gr:700/epp/proxy'));
$DataForm->AppendField( new DataFormField("Login", FORM_FIELD_TYPE::TEXT, null, null, null, null, 'digitalbox1'));
$DataForm->AppendField( new DataFormField("Password", FORM_FIELD_TYPE::TEXT , null, null, null, null, 'agrigo'));
示例4: testEPP
//.........这里部分代码省略.........
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());
}
////
// 7. UPDATE Domain�s status to OK
//
try {
$changes = $Domain->GetFlagChangelist();
foreach ($RDomain->GetFlagList() as $flag) {
$changes->Remove($flag);
}
$this->Registry->UpdateDomainFlags($Domain, $changes);
//$changes = $Domain->GetFlagChangelist();
//$changes->Add('ok');
//$this->Registry->UpdateDomainFlags($Domain, $changes);
$this->assertTrue($Domain->GetFlagList() == array(), 'Update domain status');
$Domain->SetFlagList(array('ok'));
// ok flag set automatical when all other were removed
// ^our bug ?
} catch (Exception $e) {
return $this->fail('Update domain status. Error: ' . $e->getMessage());
}
////
// 8. 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->assertTrue($RDomain->Name == $Domain->Name && date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) && $RDomain->GetFlagList() == array('ok'), 'Get remote domain');
} catch (Exception $e) {
return $this->fail('Get remote domain. Error: ' . $e->getMessage());
}
////
// 10. UPDATE one of the name server�s IP Address
//
try {
$ns1->IPAddr = gethostbyname('ns.hostdad.com');
$Resp = $this->Registry->GetModule()->UpdateNameserverHost($ns1);
$this->assertTrue($Resp->Result, 'Update domain nameserver');
} catch (Exception $e) {
return $this->fail('Update domain nameserver. Error: ' . $e->getMessage());
}
////
// 12. Renew Domain for 2 years
//
try {
$old_expire_date = $Domain->ExpireDate;
$this->Registry->RenewDomain($Domain, $extra = array('period' => 2));
$this->assertTrue(date('Ymd', $Domain->ExpireDate) == date('Ymd', strtotime('+2 year', $old_expire_date)), 'Domain renewal');
} catch (Exception $e) {
return $this->fail('Domain renewal. Error: ' . $e->getMessage());
}
////
// Remove domain nameservers
try {
$nslist = $Domain->GetNameserverChangelist();
$nslist->Remove($ns1);
$nslist->Remove($ns2);
$nslist->Remove($ns3);
$this->Registry->UpdateDomainNameservers($Domain, $nslist);
$this->assertTrue(count($Domain->GetNameserverList()) == 0, 'Remove nameservers from domain');
} catch (Exception $e) {
return $this->fail('Remove nameservers from domain. Error: ' . $e->getMessage());
}
////
// Delete nameservers
try {
$this->Registry->DeleteNameserverHost($ns1);
$this->Registry->DeleteNameserverHost($ns2);
$this->assertTrue(true, 'Delete nameservers');
} catch (Exception $e) {
return $this->fail('Delete nameservers. Error: ' . $e->getMessage());
}
////
// Delete domain
try {
$this->Registry->DeleteDomain($Domain);
$this->assertTrue(true, 'Delete domain');
} catch (Exception $e) {
return $this->fail('Delete domain. Error: ' . $e->getMessage());
}
////
/// Delete contact
try {
$this->Registry->DeleteContact($Registrant);
$this->assertTrue(true, 'Delete contact');
} catch (Exception $e) {
return $this->fail('Delete contact. Error: ' . $e->getMessage());
}
}
示例5: RunTest
//.........这里部分代码省略.........
}
$Registry->UpdateDomainFlags($Domain, $changes);
//$changes = $Domain->GetFlagChangelist();
//$changes->Add('ok');
//$this->Registry->UpdateDomainFlags($Domain, $changes);
$op['ok'] = $Domain->GetFlagList() == array();
$Domain->SetFlagList(array('ok'));
// ok flag set automatical when all other were removed
} catch (Exception $e) {
$op['ok'] = false;
$op['fail_reason'] = $e->getMessage();
}
$oplog[] = $op;
////
// 8. Perform an INFO command on the domain to verify update
//
$op = array('title' => "Perform an INFO command on the domain to verify update");
try {
$RDomain = $Registry->NewDomainInstance();
$RDomain->Name = $Domain->Name;
$RDomain = $Registry->GetRemoteDomain($RDomain);
$op['ok'] = $RDomain->Name == $Domain->Name && date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) && $RDomain->GetFlagList() == array('ok');
} catch (Exception $e) {
$op['ok'] = false;
$op['fail_reason'] = $e->getMessage();
}
$oplog[] = $op;
////
// 9. UPDATE Domain's AUTH INFO Code
//
$op = array('title' => "UPDATE Domain's AUTH INFO Code");
try {
// ���������� AUTH ����������� �������������� � �����-�������� API
$VerisignModule = $Registry->GetModule();
$Domain->AuthCode = "ae2Yo&#YARR1";
$params = array('name' => $Domain->GetHostName(), 'subproduct' => 'dot' . strtoupper($Domain->Extension), 'add' => '', 'remove' => '', 'change' => "<domain:chg><domain:authInfo><domain:pw>{$Domain->AuthCode}</domain:pw></domain:authInfo></domain:chg>");
$Resp = $VerisignModule->Request('domain-update', $params);
$success = $Resp->Succeed || $Resp->Code == RFC3730_RESULT_CODE::OK_PENDING;
$op['ok'] = $success;
} catch (Exception $e) {
$op['ok'] = false;
$op['fail_reason'] = $e->getMessage();
}
$oplog[] = $op;
////
// 10. UPDATE one of the name server's IP Address
//
$op = array('title' => "UPDATE one of the name server's IP Address");
try {
$ns1->IPAddr = gethostbyname('ns.hostdad.com');
$Resp = $Module->UpdateNameserverHost($ns1);
$op['ok'] = $Resp->Result;
} catch (Exception $e) {
$op['ok'] = false;
$op['fail_reason'] = $e->getMessage();
}
$oplog[] = $op;
////
// 11. Perform a HELLO command
//
$op = array('title' => "Perform a HELLO command");
try {
$VerisignModule = $Registry->GetModule();
$Resp = $VerisignModule->Request('hello', $params = array());
$op['ok'] = $Resp == true;
} catch (Exception $e) {