1
+ <?php
2
+ /*
3
+ * Example taken from Official Documentation
4
+ <?xml version="1.0" encoding="UTF-8"?>
5
+ <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
6
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7
+ xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
8
+ xmlns:dnsbe="http://www.dns.be/xml/epp/dnsbe-1.0"
9
+ xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd
10
+ urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd
11
+ http://www.dns.be/xml/epp/dnsbe-1.0 dnsbe-1.0.xsd">
12
+ <command>
13
+ <update>
14
+ <domain:update>
15
+ <domain:name>greatdomain.be</domain:name>
16
+ <domain:add>
17
+ <domain:ns>
18
+ <domain:hostAttr>
19
+ <domain:hostName>ns2.greatdomain.be</domain:hostName>
20
+ <domain:hostAddr>193.168.0.2</domain:hostAddr>
21
+ </domain:hostAttr>
22
+ </domain:ns>
23
+ <domain:contact type="onsite">c18</domain:contact>
24
+ </domain:add>
25
+ <domain:rem>
26
+ <domain:ns>
27
+ <domain:hostAttr>
28
+ <domain:hostName>ns.hostingcompany.be</domain:hostName>
29
+ </domain:hostAttr>
30
+ </domain:ns>
31
+ </domain:rem>
32
+ </domain:update>
33
+ </update>
34
+ <extension>
35
+ <dnsbe:ext>
36
+ <dnsbe:update>
37
+ <dnsbe:domain>
38
+ <dnsbe:add>
39
+ <dnsbe:nsgroup>newnsgroup1</dnsbe:nsgroup>
40
+ </dnsbe:add>
41
+ <dnsbe:rem>
42
+ <dnsbe:nsgroup>mynsgroup1</dnsbe:nsgroup>
43
+ </dnsbe:rem>
44
+ </dnsbe:domain>
45
+ </dnsbe:update>
46
+ </dnsbe:ext>
47
+ </extension>
48
+ <clTRID>clientref-00020</clTRID>
49
+ </command>
50
+ </epp>
51
+ */
52
+
53
+ namespace Metaregistrar \EPP ;
54
+
55
+ class dnsbeEppUpdateDomainRequest extends eppUpdateDomainRequest {
56
+
57
+ function __construct ($ objectname , $ addinfo = null , $ removeinfo = null , $ updateinfo = null , $ forcehostattr = true , $ namespacesinroot = true ) {
58
+ parent ::__construct ($ objectname , $ addinfo , $ removeinfo , $ updateinfo , $ forcehostattr , $ namespacesinroot );
59
+ $ this ->setForcehostattr ($ forcehostattr );
60
+ $ this ->addSessionId ();
61
+ }
62
+
63
+ public function updatensgroup ($ addnsgroup = null , $ removensgroup = null ) {
64
+ $ this ->addExtension ('xmlns:dnsbe ' , 'http://www.dns.be/xml/epp/dnsbe-1.0 ' );
65
+ $ ext = $ this ->createElement ('extension ' );
66
+ $ dnsext = $ this ->createElement ('dnsbe:ext ' );
67
+ $ update = $ this ->createElement ('dnsbe:update ' );
68
+ $ domain = $ this ->createElement ('dnsbe:domain ' );
69
+ if ($ addnsgroup !== null ) {
70
+ if (is_array ($ addnsgroup ) && !empty ($ addnsgroup )) {
71
+ $ add = $ this ->createElement ('dnsbe:add ' );
72
+ foreach ($ addnsgroup as $ nsgroupname ) {
73
+ $ add ->appendChild ($ this ->createElement ('dnsbe:nsgroup ' , $ nsgroupname ));
74
+ }
75
+ } elseif (is_string ($ addnsgroup )) {
76
+ $ add = $ this ->createElement ('dnsbe:add ' );
77
+ $ add ->appendChild ($ this ->createElement ('dnsbe:nsgroup ' , $ addnsgroup ));
78
+ } else {
79
+ throw new eppException ("addnsgroup must either be an array or a string in updatensgroup " );
80
+ }
81
+ $ domain ->appendChild ($ add );
82
+ }
83
+ if ($ removensgroup !== null ) {
84
+ if (is_array ($ removensgroup ) && !empty ($ removensgroup )) {
85
+ $ rem = $ this ->createElement ('dnsbe:rem ' );
86
+ foreach ($ removensgroup as $ nsgroupname ) {
87
+ $ rem ->appendChild ($ this ->createElement ('dnsbe:nsgroup ' , $ nsgroupname ));
88
+ }
89
+ } elseif (is_string ($ removensgroup )) {
90
+ $ rem = $ this ->createElement ('dnsbe:rem ' );
91
+ $ rem ->appendChild ($ this ->createElement ('dnsbe:nsgroup ' , $ removensgroup ));
92
+ } else {
93
+ throw new eppException ("removensgroup must either be an array or a string in updatensgroup " );
94
+ }
95
+ $ domain ->appendChild ($ rem );
96
+ }
97
+ $ update ->appendChild ($ domain );
98
+ $ dnsext ->appendChild ($ update );
99
+ $ ext ->appendChild ($ dnsext );
100
+ $ this ->getCommand ()->appendChild ($ ext );
101
+ $ this ->addSessionId ();
102
+ }
103
+
104
+ }
0 commit comments