Skip to content

Commit 2fdf161

Browse files
committed
implemented Order: Create_Domain
1 parent d4e0635 commit 2fdf161

File tree

4 files changed

+84
-1
lines changed

4 files changed

+84
-1
lines changed

Examples/RegisterDomain.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Subreg - RegisterDomain Example
4+
*
5+
* @author Vítězslav Dvořák <[email protected]>
6+
* @copyright (C) 2018 Spoje.Net
7+
*/
8+
9+
namespace Subreg;
10+
11+
require_once '../vendor/autoload.php';
12+
13+
\Ease\Shared::instanced()->loadConfig('../config.json');
14+
15+
$client = new Client(\Ease\Shared::instanced()->configuration);
16+
17+
$unexistentDomain = strtolower(\Ease\Sand::randomString()).'.cz';
18+
19+
$nsHosts = array("ns.spoje.net", "ns2.spoje.net");
20+
21+
print_r($client->registerDomain($unexistentDomain, 'G-000001', 'G-000001', 'G-000001', 'ukulele', $nsHosts));
22+
23+
24+
$response = $client->checkDomain($unexistentDomain);
25+
26+
var_dump($response);

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"EASE_APPNAME": "PHP Subreg",
3-
"EASE_LOGGER": "syslog",
3+
"EASE_LOGGER": "syslog|console",
44
"location": "https://ote-soap.subreg.cz/cmd.php",
55
"uri": "https://ote-soap.subreg.cz/soap",
66
"login": "php-subreg",

nbproject/configs/Register.properties

Whitespace-only changes.

src/Subreg/Client.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,63 @@ public function checkDomain($domain)
148148
return $this->call('Check_Domain', ['domain' => $domain]);
149149
}
150150

151+
/**
152+
* Create a new domain
153+
*
154+
* @link https://subreg.cz/manual/?cmd=Create_Domain Order: Create_Domain
155+
*
156+
* @param string $domain
157+
* @param string $registrantID
158+
* @param string $contactsAdminID
159+
* @param string $contactsTechID
160+
* @param string $authID
161+
* @param array $nsHosts Hostnames of nameservers: ['ns.domain.cz','ns2.domain.cz']
162+
* @param string $nsset Nameserver Set (only for FRED registries (.CZ,.EE,...))
163+
* @param int $period
164+
*
165+
* @return array
166+
*/
167+
public function registerDomain($domain, $registrantID, $contactsAdminID,
168+
$contactsTechID, $authID, $nsHosts = [],
169+
$nsset = null, $period = 1)
170+
{
171+
172+
foreach ($nsHosts as $host) {
173+
$ns[]["hostname"] = $host;
174+
}
175+
176+
$order = array(
177+
"domain" => $domain,
178+
"type" => "Create_Domain",
179+
"params" => array(
180+
"registrant" => array(
181+
"id" => $registrantID,
182+
),
183+
"contacts" => array(
184+
"admin" => array(
185+
"id" => $contactsAdminID,
186+
),
187+
"tech" => array(
188+
"id" => $contactsTechID,
189+
),
190+
),
191+
"ns" => array(
192+
"hosts" => $ns,
193+
),
194+
"params" => array(
195+
"authid" => $authID,
196+
),
197+
"period" => $period
198+
)
199+
);
200+
201+
if (!empty($nsset)) {
202+
$order['params']['ns']['nsset'] = $nsset;
203+
}
204+
205+
return $this->call('Make_Order', ['order' => $order]);
206+
}
207+
151208
/**
152209
* Get all domains from your account
153210
*

0 commit comments

Comments
 (0)