forked from metaregistrar/php-epp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfodomain.php
70 lines (63 loc) · 2.11 KB
/
infodomain.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require('../autoloader.php');
use Metaregistrar\EPP\eppConnection;
use Metaregistrar\EPP\eppException;
use Metaregistrar\EPP\eppDomain;
use Metaregistrar\EPP\eppInfoDomainRequest;
use Metaregistrar\EPP\eppContactHandle;
use Metaregistrar\EPP\eppHost;
/*
* This script retrieves all information for a specific domain name
*/
if ($argc <= 1) {
echo "Usage: infodomain.php <domainname>\n";
echo "Please enter a domain name retrieve\n\n";
die();
}
$domainname = $argv[1];
echo "Retrieving info on " . $domainname . "\n";
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()) {
$result = infodomain($conn, $domainname);
$conn->logout();
}
}
} catch (eppException $e) {
echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
* @param $conn Metaregistrar\EPP\eppConnection
* @param $domainname string
* @return string
*/
function infodomain($conn, $domainname) {
$info = new eppInfoDomainRequest(new eppDomain($domainname));
if ($response = $conn->request($info)) {
/* @var $response Metaregistrar\EPP\eppInfoDomainResponse */
$d = $response->getDomain();
echo "Info domain for " . $d->getDomainname() . ":\n";
echo "Created on " . $response->getDomainCreateDate() . "\n";
echo "Last update on ".$response->getDomainUpdateDate()."\n";
echo "Registrant " . $d->getRegistrant() . "\n";
echo "Status info:\n";
foreach ($d->getStatuses() as $status) {
echo " ".$status."\n";
}
echo "Contact info:\n";
foreach ($d->getContacts() as $contact) {
/* @var $contact eppContactHandle */
echo " " . $contact->getContactType() . ": " . $contact->getContactHandle() . "\n";
}
echo "Nameserver info:\n";
foreach ($d->getHosts() as $nameserver) {
/* @var $nameserver eppHost */
echo " " . $nameserver->getHostname() . "\n";
}
} else {
echo "ERROR2\n";
}
return null;
}