-
Notifications
You must be signed in to change notification settings - Fork 7
/
ficoraEppTransferRequest.php
49 lines (45 loc) · 1.79 KB
/
ficoraEppTransferRequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace FicoraEpp;
use Metaregistrar\EPP\eppDomain;
use Metaregistrar\EPP\eppException;
use Metaregistrar\EPP\eppHost;
use Metaregistrar\EPP\eppRequest;
use Metaregistrar\EPP\eppTransferRequest;
class ficoraEppTransferRequest extends eppRequest
{
/**
* @param eppDomain $domain
* @throws eppException
*/
public function __construct($domain)
{
parent::__construct();
$transfer = $this->createElement('transfer');
$transfer->setAttribute('op', eppTransferRequest::OPERATION_REQUEST);
$this->domainobject = $this->createElement('domain:transfer');
$this->domainobject->setAttribute('xmlns:domain','urn:ietf:params:xml:ns:domain-1.0');
$this->domainobject->appendChild($this->createElement('domain:name', $domain->getDomainname()));
if (strlen($domain->getAuthorisationCode())) {
$authinfo = $this->createElement('domain:authInfo');
$authinfo->appendChild($this->createElement('domain:pw', $domain->getAuthorisationCode()));
$this->domainobject->appendChild($authinfo);
}
$transfer->appendChild($this->domainobject);
$ns = $this->createElement('domain:ns');
$nameservers = $domain->getHosts();
foreach ($nameservers as $nsRecord) {
/**
* @var eppHost $nsRecord
*/
if ($nsRecord->getHostname()) {
$hostObj = $this->createElement('domain:hostObj', $nsRecord->getHostname());
$ns->appendChild($hostObj);
} else {
throw new eppException("nsRecord has no hostname on metaregEppTransferExtendedRequest");
}
}
$this->domainobject->appendChild($ns);
$this->getCommand()->appendChild($transfer);
$this->addSessionId();
}
}