本文整理汇总了PHP中Registry::GetRemoteContact方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::GetRemoteContact方法的具体用法?PHP Registry::GetRemoteContact怎么用?PHP Registry::GetRemoteContact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::GetRemoteContact方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rand
function _testEPP ()
{
$Domain = $this->Registry->NewDomainInstance();
$Domain->Name = 'webta' . rand(1000, 9999);
// check domain
try
{
$ok = $this->Registry->DomainCanBeRegistered($Domain);
$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);
$Domain->SetNameserverList(array(
new Nameserver('ns.hostdad.com'),
new Nameserver('ns2.hostdad.com')
));
$this->DBDomain->Save($Domain);
$this->Registry->CreateDomain($Domain, 2, array('comment' => 'abc'));
$this->assertTrue(true, 'Create domain');
}
catch (Exception $e)
{
return $this->fail('Create domain. Error: ' . $e->getMessage());
}
$Obs = new TestRegistryObserver($this->Registry, $this);
$this->Registry->AttachObserver($Obs);
$this->Registry->DispatchPendingOperations();
}
示例2: 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 {
//.........这里部分代码省略.........
示例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());
}
//.........这里部分代码省略.........
示例4:
//.........这里部分代码省略.........
$this->assertTrue(false, 'Contact created');
var_dump($e);
}
try
{
$c = $this->registry->NewContactInstance("tech");
$c->SetFieldList(array(
'name' => 'marat komarov',
'org' => 'MK1O',
'cc' => 'NO',
'sp' => 'crimea',
'city' => 'TRONDHEIM',
'pc' => '7491',
'sp' => 'Crimea',
'street1' => 'bbfdgfd fds',
'street2' => 'dsf fd d',
'voice' => '+33.12345678',
'fax' => '+33.12345678',
'email' => 'igor@webta.net'
));
}
catch(ErrorList $e)
{
var_dump($e);
}
try
{
//$this->registry->CreateContact($c);
//$this->assertTrue(true, 'Contact created');
}
catch (Exception $e)
{
$this->assertTrue(false, 'Contact created');
var_dump($e);
}
exit();
sleep(1);
try
{
$c->SetFieldList(array(
'name' => 'marat komarov2',
'org' => 'MK1O2',
'cc' => 'UA',
'sp' => 'crimea2',
'city' => 'TRONDHEIM2',
'pc' => '74912',
'sp' => 'Crimea2',
'street1' => 'bbfdgfd fds2',
'street2' => 'dsf fd d2',
'voice' => '+33.123456782',
'fax' => '+33.123456782',
'email' => 'igor@webta.net'
));
}
catch(ErrorList $e)
{
var_dump($e);
exit();
}
try
{
//$this->registry->UpdateContact($c);
}
catch (Exception $e)
{
$this->assertTrue(false, 'Contact updated');
var_dump($e->getMessage());
}
sleep(1);
*/
$c = DBContact::GetInstance()->LoadByCLID("11390275");
try
{
$c2 = $this->registry->GetRemoteContact($c);
var_dump($c2);
$this->assertTrue($c2, 'Remote contact received');
}
catch (Exception $e)
{
var_dump($e);
$this->assertTrue(false, 'remote contact received');
}
try
{
//$this->registry->DeleteContact($c2);
}
catch (Exception $e)
{
$this->assertTrue(false, 'Contact deleted');
var_dump($e->getMessage());
}
}