forked from hosting-de-labs/hostingde-api-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
60 lines (47 loc) · 1.28 KB
/
Copy pathexample.php
File metadata and controls
60 lines (47 loc) · 1.28 KB
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
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Hostingde\API;
use Hostingde\API\Hostingde\API\DomainApi;
require_once("require.php");
$useContact = 'Handle, bspw. XX1234';
$useDomain = 'Domainname, bspw. example.com';
$api = new DomainApi('ApiKey');
if ($check = $api->domainStatus(array("example.de", "example.com", "123.hosting"))) {
// print_r($check);
} else {
print_r($api->getErrors());
die();
}
$filter = new Filter();
$filter->addFilter('ContactHandle', $useContact);
$filter->addFilter('ContactType', 'Person');
// Filter mit OR statt AND verbinden
// $filter->set('subFilterConnective', 'OR');
$contacts = $api->contactsFind($filter);
if ($contact = $api->contactInfo($useContact)) {
// laden erfolgreich
} else {
// Errors anzeigen
print_r($api->getErrors());
}
$contact->set('emailAddress', 'noreply@example.com');
if ($contact = $api->contactUpdate($contact)) {
// Update erfolgreich
} else {
// Errors anzeigen
print_r($api->getErrors());
}
// bestimmte Domain finden
if ($domain = $api->domainInfo($useDomain)) {
// laden erfolgreich
} else {
// Errors anzeigen
print_r($api->getErrors());
}
// Kontakt setzen oder austauschen
$domain->addContact('admin', $useContact);
if ($domain = $api->domainUpdate($domain)) {
// Update erfolgreich
} else {
// Errors anzeigen
print_r($api->getErrors());
}