Browse code

Umstellung von SOAP-API auf JSON-API

Bernd Wurst authored on 19/01/2018 23:10:13
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,615 +0,0 @@
1
-<?php
2
-
3
-class domainRobotDefaultObject {
4
-	public function set($key, $value)
5
-	{
6
-		$this->{$key} = $value;
7
-	}
8
-
9
-	public function get($key)
10
-	{
11
-		return $this->{$key};
12
-	}
13
-}
14
-
15
-class domainRobotDefaultRequest extends domainRobotDefaultObject {
16
-	private $clientTransactionId;
17
- 	private $authToken;
18
-	
19
-	public function __construct($authToken)
20
-	{
21
-		$this->authToken = $authToken;
22
-		$this->_generateTransactionId();
23
-	}
24
-
25
-	private function _generateTransactionId()
26
-	{
27
-		$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjklmnpqrstuvwxyz0123456789";
28
-		$pass = "";
29
-		for($i = 0; $i < 12; $i++) {
30
-			$pass .= $chars[mt_rand(0, strlen($chars) - 1)];
31
-		}
32
-		$this->clientTransactionId = date("YmdHis")."-".$pass;
33
-	}
34
-
35
-	public function overrideTransactionId($id)
36
-	{
37
-		$this->clientTransactionId = $id;
38
-	}
39
-
40
-	public function getTransactionId()
41
-	{
42
-		return $this->clientTransactionId;
43
-	}
44
-}
45
-
46
-class domainRobotContact extends domainRobotDefaultObject {
47
-	public $accountId;
48
-	public $id;
49
-	public $handle;
50
-	public $type;
51
-	public $name;
52
-	public $organization;
53
-	public $street;
54
-	public $postalCode;
55
-	public $city;
56
-	public $state;
57
-	public $country;
58
-	public $phoneNumber;
59
-	public $faxNumber;
60
-	public $emailAddress;
61
-	public $sipUri;
62
-	public $lastChangeDate;
63
-	public $hidden;
64
-	public $extGender;
65
-	public $extCompanyNumber;
66
-	public $extCompanyNumberCountry;
67
-	public $extTradingName;
68
-	public $extTaxId;
69
-	public $extTaxIdCountry;
70
-	public $extDateOfBirth;
71
-	public $extPlaceOfBirth;
72
-	public $extPlaceOfBirthZipCode;
73
-	public $extCountryOfBirth;
74
-	public $extLanguage;
75
-	public $extNationality;
76
-	public $extRemarks;
77
-	public $extIdentificationCardNumber;
78
-	public $extIdentificationCardIssuingAuthority;
79
-	public $extIdentificationCardIssueDate;
80
-	public $extIdentificationCardValidUntil;
81
-	public $extIdentificationCardCountry;
82
-	public $extTradeMarkName;
83
-	public $extTradeMarkRegistrationAuthority;
84
-	public $extTradeMarkRegisterNumber;
85
-	public $extTradeMarkCountry;
86
-	public $extTradeMarkDateOfApplication;
87
-	public $extTradeMarkDateOfRegistration;
88
-	public $extAeroIdentificationNumber;
89
-	public $extAeroPassword;
90
-	public $extCaLegalType;
91
-	public $extCatIntendedUsage;
92
-	public $extUkType;
93
-	public $extProProfession;
94
-	public $extProAuthorityName;
95
-	public $extProAuthorityUrl;
96
-	public $extProLicenseNumber;
97
-	public $extTravelUniqueIdentificationNumber;
98
-	public $extXxxMemberId;
99
-}
100
-
101
-class domainRobotDomainContact extends domainRobotDefaultObject {
102
-	public $type;
103
- 	public $contact;
104
-
105
-	public function __construct($type, $contact)
106
-	{
107
-		$this->set("type", $type);
108
-		$this->set("contact", $contact);
109
-	}
110
-}
111
-
112
-class domainRobotDomain extends domainRobotDefaultObject {
113
-	public $accountId = NULL;
114
-	public $id = NULL;
115
-	public $name;
116
-	public $nameUnicode;
117
-	public $contacts;
118
-	public $nameservers;
119
-	public $status;
120
-	public $transferLockEnabled;
121
-	public $authInfo;
122
-	public $addDate;
123
-	public $createDate;
124
-	public $lastChangeDate;
125
-	public $terminableByDate;
126
-	public $currentContractPeriodEnd;
127
-	public $nextContractPeriodStart;
128
-	public $deletionDate;
129
-	public $deletionType;
130
-}
131
-
132
-class domainRobotTransferData extends domainRobotDefaultObject {
133
-	public $authInfo;
134
-	public $authInfo2;
135
-	public $foaRecipient;
136
-}
137
-
138
-class domainRobotFilter extends domainRobotDefaultObject {
139
-	public $field;
140
-	public $value;
141
-	public $relation;
142
-	public $subFilterConnective;
143
-	public $subFilter;
144
-}
145
-
146
-class domainRobotSortOptions extends domainRobotDefaultObject {
147
-	public $field;
148
-	public $order;
149
-}
150
-
151
-class domainRobotNameserver extends domainRobotDefaultObject {
152
-	public $name;
153
-	public $ips;
154
-
155
-	public function __construct($name, $ips = NULL)
156
-	{
157
-		$this->set("name", $name);
158
-		$this->set("ips", $ips);
159
-	}
160
-}
161
-
162
-class domainRobotApi {
163
-
164
-	private $location = "https://partner.http.net/api/domain/v1/soap/";
165
-
166
-	private $authToken;
167
-        private $soap = NULL;
168
-
169
-	private $lastRequestId = NULL;
170
-	private $lastResponse = NULL;
171
-
172
-	private $transactionId = NULL;
173
-
174
-	public function __construct($authToken, $location = NULL)
175
-	{
176
-		$this->authToken = $authToken;
177
-        if ($location) {
178
-            $this->location = $location;
179
-        }
180
-		try {
181
-			if ($client = new SOAPClient(__DIR__."/domainrobot.wsdl", array('trace' => true, 'location' => $this->location, 'connection_timeout' => 10, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)))
182
-			{
183
-				$this->soap = $client;
184
-			} else {
185
-				return false;
186
-			}
187
-		} catch (Exception $e) {
188
-			return false;
189
-		}
190
-	}
191
-
192
-	public function setTransactionId($transactionId) {
193
-		$this->transactionId = $transactionId;
194
-	}
195
-
196
-	public function resetLocation($url)
197
-	{
198
-		$this->location = $url;
199
-		$this->__construct($this->authToken);
200
-	}
201
-
202
-	private function _request($action, $request)
203
-	{
204
-		if (isset($this->transactionId)) {
205
-			$request->overrideTransactionId($this->transactionId);
206
-		}
207
-		$this->lastRequestId = $request->getTransactionId();
208
-		try {
209
-			$this->lastResponse = $this->soap->{$action}($request);
210
-			return true;
211
-		} catch (Exception $e) {
212
-			return false;
213
-		}
214
-	}
215
-
216
-	public function request($action, $request)
217
-	{
218
-		return $this->_request($action, $request);
219
-	}
220
-
221
-	public function getServerTransactionId()
222
-	{
223
-		if (isset($this->lastResponse) && isset($this->lastResponse->status)) {
224
-			return $this->lastResponse->metadata->serverTransactionId;
225
-		}
226
-		return false;
227
-	}
228
-
229
-	public function getStatus()
230
-	{
231
-		if (isset($this->lastResponse) && isset($this->lastResponse->status)) {
232
-			return $this->lastResponse->status;
233
-		}
234
-		return false;
235
-	}
236
-	
237
-	public function getErrors()
238
-	{
239
-		if (isset($this->lastResponse) && isset($this->lastResponse->errors)) {
240
-			return $this->lastResponse->errors;
241
-		}
242
-		return array();
243
-	}
244
-
245
-	public function getErrorsToString()
246
-	{
247
-		$str = NULL;
248
-		foreach($this->getErrors() as $error) {
249
-			$str .= $error->code.": ".$error->text.";";
250
-		}
251
-		return $str;
252
-	}
253
-
254
-
255
-	public function getWarnings()
256
-	{
257
-		if (isset($this->lastResponse) && isset($this->lastResponse->warnings)) {
258
-			return $this->lastResponse->warnings;
259
-		}
260
-		return array();
261
-	}
262
-
263
-	public function getValue()
264
-	{
265
-		if (isset($this->lastResponse) && isset($this->lastResponse->value)) {
266
-			return $this->lastResponse->value;
267
-		} elseif (isset($this->lastResponse) && isset($this->lastResponse->values)) {
268
-			return $this->lastResponse->values;
269
-		}
270
-		return false;
271
-	}
272
-
273
-	public function contactsFindByData($data)
274
-	{
275
-		$filter = new domainRobotFilter();
276
-		$filter->set("field", NULL);
277
-		$filter->set("value", NULL);
278
-		$filter->set("subFilterConnective", "AND");
279
-		$subFilters = array();
280
-		foreach($data as $key => $value) {
281
-			$subFilter = new domainRobotFilter();
282
-			$subFilter->set("field", "contact".ucfirst($key));
283
-			$subFilter->set("value", $value);
284
-			$subFilters[] = $subFilter;
285
-		}
286
-		$filter->set("subFilter", $subFilters);
287
-
288
-		$sort = new domainRobotSortOptions();
289
-		$sort->set("field", "contactName");
290
-		$sort->set("order", "ASC");
291
-
292
-		$request = new domainRobotDefaultRequest($this->authToken);
293
-		$request->set("filter", $filter);
294
-		$request->set("limit", 0);
295
-		$request->set("page", 1);
296
-		$request->set("sort", $sort);
297
-		return $this->_request("contactsFind", $request);
298
-	}
299
-
300
-	public function contactsFind($nameFilter = NULL)
301
-	{
302
-		$filter = NULL;
303
-		if (strlen($nameFilter)) {
304
-			$filter = new domainRobotFilter();
305
-			$filter->set("field", "contactName");
306
-			$filter->set("value", $nameFilter);
307
-		}
308
-
309
-		$sort = new domainRobotSortOptions();
310
-		$sort->set("field", "contactName");
311
-		$sort->set("order", "ASC");
312
-
313
-		$request = new domainRobotDefaultRequest($this->authToken);
314
-		$request->set("filter", $filter);
315
-		$request->set("limit", 0);
316
-		$request->set("page", 1);
317
-		$request->set("sort", $sort);
318
-		return $this->_request("contactsFind", $request);
319
-	}
320
-
321
-	public function contactCreate($data)
322
-	{
323
-		$contact = new domainRobotContact();
324
-		foreach($data as $key => $value) {
325
-			$contact->set($key, $value);
326
-		}
327
-		$request = new domainRobotDefaultRequest($this->authToken);
328
-		$request->set("contact", $contact);
329
-		return $this->_request("contactCreate", $request);
330
-	}
331
-
332
-	public function contactUpdate($data)
333
-	{
334
-		$contact = new domainRobotContact();
335
-		foreach($data as $key => $value) {
336
-			$contact->set($key, $value);
337
-		}
338
-		$request = new domainRobotDefaultRequest($this->authToken);
339
-		$request->set("contact", $contact);
340
-		return $this->_request("contactUpdate", $request);
341
-	}
342
-
343
-	public function contactInfo($contact)
344
-	{
345
-		$request = new domainRobotDefaultRequest($this->authToken);
346
-		$request->set("contactId", $contact);
347
-		return $this->_request("contactInfo", $request);
348
-	}
349
-
350
-	public function contactDelete($contact, $deleteNow)
351
-	{
352
-		$request = new domainRobotDefaultRequest($this->authToken);
353
-		$request->set("contactId", $contact);
354
-		$request->set("deleteNow", $deleteNow);
355
-		return $this->_request("contactDelete", $request);
356
-	}
357
-
358
-	private function _getContacts($data)
359
-	{
360
-		$owner = new domainRobotDomainContact("owner", $data['owner']);
361
-		$admin = new domainRobotDomainContact("admin", $data['admin']);
362
-		$tech = new domainRobotDomainContact("tech", $data['tech']);
363
-		$zone = new domainRobotDomainContact("zone", $data['zone']);
364
-		$contacts = array($owner, $admin, $tech, $zone);
365
-		if (isset($data['billing'])) {
366
-			$billing = new domainRobotDomainContact("billing", $data['billing']);
367
-			$contacts = array($owner, $admin, $tech, $zone, $billing);
368
-		}
369
-		return $contacts;
370
-	}
371
-
372
-	private function _getNameservers($data)
373
-	{
374
-		$nameservers = array();
375
-		foreach($data['nameservers'] as $ns) {
376
-			$ipv4 = NULL;
377
-			if (isset($ns['ipv4'])) {
378
-				$ipv4 = $ns['ipv4'];
379
-			}
380
-			$ipv6 = NULL;
381
-			if (isset($ns['ipv6'])) {
382
-				$ipv6 = $ns['ipv6'];
383
-			}
384
-			$nameserver = new domainRobotNameserver($ns['name'], $ipv4, $ipv6);
385
-			$nameservers = array_merge($nameservers, array($nameserver));
386
-		}
387
-		return $nameservers;
388
-	}
389
-
390
-	public function domainsFindByName($nameFilter)
391
-	{
392
-		$filter = new domainRobotFilter();
393
-		$filter->set("field", "domainName");
394
-		$filter->set("value", $nameFilter);
395
-
396
-		$sort = new domainRobotSortOptions();
397
-		$sort->set("field", "domainName");
398
-		$sort->set("order", "ASC");
399
-
400
-		$request = new domainRobotDefaultRequest($this->authToken);
401
-		$request->set("filter", $filter);
402
-		$request->set("limit", 0);
403
-		$request->set("page", 1);
404
-		$request->set("sort", $sort);
405
-		return $this->_request("domainsFind", $request);
406
-	}
407
-
408
-	public function domainsFindByHandle($handleFilter)
409
-	{
410
-		$filter = new domainRobotFilter();
411
-		$filter->set("field", "contactId");
412
-		$filter->set("value", $handleFilter);
413
-
414
-		$sort = new domainRobotSortOptions();
415
-		$sort->set("field", "domainName");
416
-		$sort->set("order", "ASC");
417
-
418
-		$request = new domainRobotDefaultRequest($this->authToken);
419
-		$request->set("filter", $filter);
420
-		$request->set("limit", 0);
421
-		$request->set("page", 1);
422
-		$request->set("sort", $sort);
423
-		return $this->_request("domainsFind", $request);
424
-	}
425
-
426
-	public function domainInfo($domain)
427
-	{
428
-		$request = new domainRobotDefaultRequest($this->authToken);
429
-		$request->set("domainName", $domain);
430
-		return $this->_request("domainInfo", $request);
431
-	}
432
-
433
-	public function domainStatus($domains)
434
-	{
435
-		$request = new domainRobotDefaultRequest($this->authToken);
436
-		$request->set("domainNames", $domains);
437
-		return $this->_request("domainStatus", $request);
438
-	}
439
-
440
-	public function domainCreate($data, $execDate = NULL)
441
-	{
442
-		$domain = new domainRobotDomain();
443
-		$domain->set("name", $data['name']);
444
-		$domain->set("contacts", $this->_getContacts($data));
445
-		$domain->set("nameservers", $this->_getNameservers($data));
446
-		$domain->set("transferLockEnabled", true);
447
-
448
-		$request = new domainRobotDefaultRequest($this->authToken);
449
-		$request->set("domain", $domain);
450
-		$request->set("registrationPeriod", 1);
451
-		$request->set("execDate", $execDate);
452
-		return $this->_request("domainCreate", $request);
453
-	}
454
-
455
-	public function domainTransfer($data, $execDate = NULL)
456
-	{
457
-		$domain = new domainRobotDomain();
458
-		$domain->set("name", $data['name']);
459
-		$domain->set("contacts", $this->_getContacts($data));
460
-		$domain->set("nameservers", $this->_getNameservers($data));
461
-		$domain->set("transferLockEnabled", true);
462
-
463
-		$transferData = new domainRobotTransferData();
464
-		if (isset($data['authInfo'])) {
465
-			$transferData->set("authInfo", $data['authInfo']);
466
-		}
467
-		$transferData->set("foaRecipient", "both");
468
-
469
-		$request = new domainRobotDefaultRequest($this->authToken);
470
-		$request->set("domain", $domain);
471
-		$request->set("transferData", $transferData);
472
-		$request->set("execDate", $execDate);
473
-		return $this->_request("domainTransfer", $request);
474
-	}
475
-
476
-	public function domainUpdate($data)
477
-	{
478
-		$domain = new domainRobotDomain();
479
-		$domain->set("name", $data['name']);
480
-		$domain->set("contacts", $this->_getContacts($data));
481
-		$domain->set("nameservers", $this->_getNameservers($data));
482
-		$domain->set("transferLockEnabled", true);
483
-		if (isset($data['transferLockEnabled'])) {
484
-			$domain->set("transferLockEnabled", $data['transferLockEnabled']);
485
-		}
486
-
487
-		$request = new domainRobotDefaultRequest($this->authToken);
488
-		$request->set("domain", $domain);
489
-		return $this->_request("domainUpdate", $request);
490
-	}
491
-
492
-	public function domainCreateAuthInfo($domain)
493
-	{
494
-		$request = new domainRobotDefaultRequest($this->authToken);
495
-		$request->set("domainName", $domain);
496
-		return $this->_request("domainCreateAuthInfo", $request);
497
-	}
498
-
499
-	public function domainCreateAuthInfo2($domain)
500
-	{
501
-		$request = new domainRobotDefaultRequest($this->authToken);
502
-		$request->set("domainName", $domain);
503
-		return $this->_request("domainCreateAuthInfo2", $request);
504
-	}
505
-
506
-	public function domainDelete($domain, $execDate = NULL)
507
-	{
508
-		$request = new domainRobotDefaultRequest($this->authToken);
509
-		$request->set("domainName", $domain);
510
-		$request->set("execDate", $execDate);
511
-		return $this->_request("domainDelete", $request);
512
-	}
513
-
514
-	public function domainWithdraw($domain, $disconnect = true, $execDate = NULL)
515
-	{
516
-		$request = new domainRobotDefaultRequest($this->authToken);
517
-		$request->set("domainName", $domain);
518
-		$request->set("disconnect", $disconnect);
519
-		$request->set("execDate", $execDate);
520
-		return $this->_request("domainWithdraw", $request);
521
-	}
522
-
523
-	public function domainSetAutoRenewMode($domain, $mode)
524
-	{
525
-		// TODO not implemented yet, moeglich ueber domainDelete/cancelJob
526
-		$request = new domainRobotDefaultRequest($this->authToken);
527
-		$request->set("domainName", $domain);
528
-		$request->set("mode", $mode);
529
-		return $this->_request("domainSetAutoRenewMode", $request);
530
-	}
531
-
532
-	public function domainSetTransferLock($domain, $mode)
533
-	{
534
-		// TODO not implemented yet, moeglich ueber domainUpdate
535
-		$request = new domainRobotDefaultRequest($this->authToken);
536
-		$request->set("domainName", $domain);
537
-		$request->set("mode", $mode);
538
-		return $this->_request("domainSetTransferLock", $request);
539
-	}
540
-
541
-	public function domainRestore($domain)
542
-	{
543
-		$request = new domainRobotDefaultRequest($this->authToken);
544
-		$request->set("domainName", $domain);
545
-		return $this->_request("domainRestore", $request);
546
-	}
547
-
548
-	public function domainChangeTag($domain, $tag)
549
-	{
550
-		$request = new domainRobotDefaultRequest($this->authToken);
551
-		$request->set("domainName", $domain);
552
-		$request->set("tag", $tag);
553
-		return $this->_request("domainChangeTag", $request);
554
-	}
555
-
556
-	public function domainTransferOutAck($domain)
557
-	{
558
-		$request = new domainRobotDefaultRequest($this->authToken);
559
-		$request->set("domainName", $domain);
560
-		return $this->_request("domainTransferOutAck", $request);
561
-	}
562
-
563
-	public function domainTransferOutNack($domain, $reason)
564
-	{
565
-		$request = new domainRobotDefaultRequest($this->authToken);
566
-		$request->set("domainName", $domain);
567
-		$request->set("reason", $reason);
568
-		return $this->_request("domainTransferOutNack", $request);
569
-	}
570
-
571
-	public function jobCancel($jobId) {
572
-		$request = new domainRobotDefaultRequest($this->authToken);
573
-		$request->set("jobId", $jobId);
574
-		return $this->_request("jobCancel", $request);
575
-	}
576
-
577
-	public function jobsFindByName($domainFilter = NULL)
578
-	{
579
-		$filter = NULL;
580
-		if (strlen($domainFilter)) {
581
-			$filter = new domainRobotFilter();
582
-			$filter->set("field", "jobDomainNameAce");
583
-			$filter->set("value", $domainFilter);
584
-		}
585
-
586
-		$sort = new domainRobotSortOptions();
587
-		$sort->set("field", "jobExecutionDate");
588
-		$sort->set("order", "DESC");
589
-
590
-		$request = new domainRobotDefaultRequest($this->authToken);
591
-		$request->set("filter", $filter);
592
-		$request->set("limit", 10);
593
-		$request->set("page", 1);
594
-		$request->set("sort", $sort);
595
-		return $this->_request("jobsFind", $request);
596
-	}
597
-
598
-	public function jobsFindById($idFilter)
599
-	{
600
-		$filter = new domainRobotFilter();
601
-		$filter->set("field", "jobId");
602
-		$filter->set("value", $idFilter);
603
-		
604
-		$sort = new domainRobotSortOptions();
605
-		$sort->set("field", "jobDomainNameAce");
606
-		$sort->set("order", "ASC");
607
-
608
-		$request = new domainRobotDefaultRequest($this->authToken);
609
-		$request->set("filter", $filter);
610
-		$request->set("limit", 0);
611
-		$request->set("page", 1);
612
-		$request->set("sort", $sort);
613
-		return $this->_request("jobsFind", $request);
614
-	}
615
-}
Browse code

API-URL konfigurierbar (für Test-API)

Bernd Wurst authored on 14/01/2018 06:02:06
Showing 1 changed files
... ...
@@ -171,9 +171,12 @@ class domainRobotApi {
171 171
 
172 172
 	private $transactionId = NULL;
173 173
 
174
-	public function __construct($authToken)
174
+	public function __construct($authToken, $location = NULL)
175 175
 	{
176 176
 		$this->authToken = $authToken;
177
+        if ($location) {
178
+            $this->location = $location;
179
+        }
177 180
 		try {
178 181
 			if ($client = new SOAPClient(__DIR__."/domainrobot.wsdl", array('trace' => true, 'location' => $this->location, 'connection_timeout' => 10, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)))
179 182
 			{
Browse code

Neue API-URL für externe Library

Bernd Wurst authored on 13/01/2018 14:02:30
Showing 1 changed files
... ...
@@ -161,7 +161,7 @@ class domainRobotNameserver extends domainRobotDefaultObject {
161 161
 
162 162
 class domainRobotApi {
163 163
 
164
-	private $location = "https://regspeed.de/api/domain/v1/soap";
164
+	private $location = "https://partner.http.net/api/domain/v1/soap/";
165 165
 
166 166
 	private $authToken;
167 167
         private $soap = NULL;
Browse code

Neue Version der http.net-Partner-API / Umstellung terions bzw. tld-systems auf http.net

Bernd Wurst authored on 06/01/2016 11:41:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,612 @@
1
+<?php
2
+
3
+class domainRobotDefaultObject {
4
+	public function set($key, $value)
5
+	{
6
+		$this->{$key} = $value;
7
+	}
8
+
9
+	public function get($key)
10
+	{
11
+		return $this->{$key};
12
+	}
13
+}
14
+
15
+class domainRobotDefaultRequest extends domainRobotDefaultObject {
16
+	private $clientTransactionId;
17
+ 	private $authToken;
18
+	
19
+	public function __construct($authToken)
20
+	{
21
+		$this->authToken = $authToken;
22
+		$this->_generateTransactionId();
23
+	}
24
+
25
+	private function _generateTransactionId()
26
+	{
27
+		$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjklmnpqrstuvwxyz0123456789";
28
+		$pass = "";
29
+		for($i = 0; $i < 12; $i++) {
30
+			$pass .= $chars[mt_rand(0, strlen($chars) - 1)];
31
+		}
32
+		$this->clientTransactionId = date("YmdHis")."-".$pass;
33
+	}
34
+
35
+	public function overrideTransactionId($id)
36
+	{
37
+		$this->clientTransactionId = $id;
38
+	}
39
+
40
+	public function getTransactionId()
41
+	{
42
+		return $this->clientTransactionId;
43
+	}
44
+}
45
+
46
+class domainRobotContact extends domainRobotDefaultObject {
47
+	public $accountId;
48
+	public $id;
49
+	public $handle;
50
+	public $type;
51
+	public $name;
52
+	public $organization;
53
+	public $street;
54
+	public $postalCode;
55
+	public $city;
56
+	public $state;
57
+	public $country;
58
+	public $phoneNumber;
59
+	public $faxNumber;
60
+	public $emailAddress;
61
+	public $sipUri;
62
+	public $lastChangeDate;
63
+	public $hidden;
64
+	public $extGender;
65
+	public $extCompanyNumber;
66
+	public $extCompanyNumberCountry;
67
+	public $extTradingName;
68
+	public $extTaxId;
69
+	public $extTaxIdCountry;
70
+	public $extDateOfBirth;
71
+	public $extPlaceOfBirth;
72
+	public $extPlaceOfBirthZipCode;
73
+	public $extCountryOfBirth;
74
+	public $extLanguage;
75
+	public $extNationality;
76
+	public $extRemarks;
77
+	public $extIdentificationCardNumber;
78
+	public $extIdentificationCardIssuingAuthority;
79
+	public $extIdentificationCardIssueDate;
80
+	public $extIdentificationCardValidUntil;
81
+	public $extIdentificationCardCountry;
82
+	public $extTradeMarkName;
83
+	public $extTradeMarkRegistrationAuthority;
84
+	public $extTradeMarkRegisterNumber;
85
+	public $extTradeMarkCountry;
86
+	public $extTradeMarkDateOfApplication;
87
+	public $extTradeMarkDateOfRegistration;
88
+	public $extAeroIdentificationNumber;
89
+	public $extAeroPassword;
90
+	public $extCaLegalType;
91
+	public $extCatIntendedUsage;
92
+	public $extUkType;
93
+	public $extProProfession;
94
+	public $extProAuthorityName;
95
+	public $extProAuthorityUrl;
96
+	public $extProLicenseNumber;
97
+	public $extTravelUniqueIdentificationNumber;
98
+	public $extXxxMemberId;
99
+}
100
+
101
+class domainRobotDomainContact extends domainRobotDefaultObject {
102
+	public $type;
103
+ 	public $contact;
104
+
105
+	public function __construct($type, $contact)
106
+	{
107
+		$this->set("type", $type);
108
+		$this->set("contact", $contact);
109
+	}
110
+}
111
+
112
+class domainRobotDomain extends domainRobotDefaultObject {
113
+	public $accountId = NULL;
114
+	public $id = NULL;
115
+	public $name;
116
+	public $nameUnicode;
117
+	public $contacts;
118
+	public $nameservers;
119
+	public $status;
120
+	public $transferLockEnabled;
121
+	public $authInfo;
122
+	public $addDate;
123
+	public $createDate;
124
+	public $lastChangeDate;
125
+	public $terminableByDate;
126
+	public $currentContractPeriodEnd;
127
+	public $nextContractPeriodStart;
128
+	public $deletionDate;
129
+	public $deletionType;
130
+}
131
+
132
+class domainRobotTransferData extends domainRobotDefaultObject {
133
+	public $authInfo;
134
+	public $authInfo2;
135
+	public $foaRecipient;
136
+}
137
+
138
+class domainRobotFilter extends domainRobotDefaultObject {
139
+	public $field;
140
+	public $value;
141
+	public $relation;
142
+	public $subFilterConnective;
143
+	public $subFilter;
144
+}
145
+
146
+class domainRobotSortOptions extends domainRobotDefaultObject {
147
+	public $field;
148
+	public $order;
149
+}
150
+
151
+class domainRobotNameserver extends domainRobotDefaultObject {
152
+	public $name;
153
+	public $ips;
154
+
155
+	public function __construct($name, $ips = NULL)
156
+	{
157
+		$this->set("name", $name);
158
+		$this->set("ips", $ips);
159
+	}
160
+}
161
+
162
+class domainRobotApi {
163
+
164
+	private $location = "https://regspeed.de/api/domain/v1/soap";
165
+
166
+	private $authToken;
167
+        private $soap = NULL;
168
+
169
+	private $lastRequestId = NULL;
170
+	private $lastResponse = NULL;
171
+
172
+	private $transactionId = NULL;
173
+
174
+	public function __construct($authToken)
175
+	{
176
+		$this->authToken = $authToken;
177
+		try {
178
+			if ($client = new SOAPClient(__DIR__."/domainrobot.wsdl", array('trace' => true, 'location' => $this->location, 'connection_timeout' => 10, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)))
179
+			{
180
+				$this->soap = $client;
181
+			} else {
182
+				return false;
183
+			}
184
+		} catch (Exception $e) {
185
+			return false;
186
+		}
187
+	}
188
+
189
+	public function setTransactionId($transactionId) {
190
+		$this->transactionId = $transactionId;
191
+	}
192
+
193
+	public function resetLocation($url)
194
+	{
195
+		$this->location = $url;
196
+		$this->__construct($this->authToken);
197
+	}
198
+
199
+	private function _request($action, $request)
200
+	{
201
+		if (isset($this->transactionId)) {
202
+			$request->overrideTransactionId($this->transactionId);
203
+		}
204
+		$this->lastRequestId = $request->getTransactionId();
205
+		try {
206
+			$this->lastResponse = $this->soap->{$action}($request);
207
+			return true;
208
+		} catch (Exception $e) {
209
+			return false;
210
+		}
211
+	}
212
+
213
+	public function request($action, $request)
214
+	{
215
+		return $this->_request($action, $request);
216
+	}
217
+
218
+	public function getServerTransactionId()
219
+	{
220
+		if (isset($this->lastResponse) && isset($this->lastResponse->status)) {
221
+			return $this->lastResponse->metadata->serverTransactionId;
222
+		}
223
+		return false;
224
+	}
225
+
226
+	public function getStatus()
227
+	{
228
+		if (isset($this->lastResponse) && isset($this->lastResponse->status)) {
229
+			return $this->lastResponse->status;
230
+		}
231
+		return false;
232
+	}
233
+	
234
+	public function getErrors()
235
+	{
236
+		if (isset($this->lastResponse) && isset($this->lastResponse->errors)) {
237
+			return $this->lastResponse->errors;
238
+		}
239
+		return array();
240
+	}
241
+
242
+	public function getErrorsToString()
243
+	{
244
+		$str = NULL;
245
+		foreach($this->getErrors() as $error) {
246
+			$str .= $error->code.": ".$error->text.";";
247
+		}
248
+		return $str;
249
+	}
250
+
251
+
252
+	public function getWarnings()
253
+	{
254
+		if (isset($this->lastResponse) && isset($this->lastResponse->warnings)) {
255
+			return $this->lastResponse->warnings;
256
+		}
257
+		return array();
258
+	}
259
+
260
+	public function getValue()
261
+	{