forked from metaregistrar/php-epp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanceldomain.php
44 lines (37 loc) · 1.07 KB
/
canceldomain.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
<?php
require('../autoloader.php');
use Metaregistrar\EPP\eppConnection;
use Metaregistrar\EPP\eppException;
use Metaregistrar\EPP\eppDomain;
use Metaregistrar\EPP\eppDeleteDomainRequest;
if ($argc <= 1) {
echo "Usage: canceldomain.php <domainname>\n";
echo "Please enter the domain name that must be deleted\n\n";
die();
}
$domainname = $argv[1];
try {
// Please enter your own settings file here under before using this example
if ($conn = eppConnection::create('')) {
// Connect to the EPP server
if ($conn->login()) {
canceldomain($conn, $domainname);
$conn->logout();
}
}
} catch (eppException $e) {
echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
* @param $conn eppConnection
* @param $domainname string
* @return null
*/
function canceldomain($conn, $domainname) {
$delete = new eppDeleteDomainRequest(new eppDomain($domainname));
if ($response = $conn->request($delete)) {
/* @var $response \Metaregistrar\EPP\eppDeleteResponse */
$response->dumpContents();
}
return null;
}