-
Notifications
You must be signed in to change notification settings - Fork 7
/
dominio.php
84 lines (76 loc) · 3.66 KB
/
dominio.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php require_once 'templates/header.php';?>
<div class="content">
<div class="container">
<div class="col-md-8 col-sm-8 col-xs-12">
<div class="well text-center">
<p><h3>Check Dominio</h3></p>
<?php
require './dominio/vendor/autoload.php';
use Helge\Loader\JsonLoader;
use Helge\Client\SimpleWhoisClient;
use Helge\Service\DomainAvailability;
$whoisClient = new SimpleWhoisClient();
$dataLoader = new JsonLoader("./dominio/vendor/helgesverre/domain-availability/src/data/servers.json");
$service = new DomainAvailability($whoisClient, $dataLoader);
?>
<hr>
<form action="" method="get" style="align-content: center;" >
<div class="form-group input-group">
<input type="text" class="form-control" name="domain" id="domain" placeholder="google.com">
<input type="submit" value="Chequear" class="btn btn-lg btn-primary btn-block">
</div>
</form>
<table border="1" cellpadding="5" class="table">
<tr>
<td>Status</td>
<td>
<?php
try {
if (isset($_GET["domain"])) {
if ($service->isAvailable($_GET["domain"])) {
echo "<span style='color:green;'>Disponible</span>";
} else {
echo "<span style='color:red;'>Ocupado</span>";
}
}
} catch (\Exception $e) {
echo $e->getMessage();
}
?>
</td>
</tr>
<tr>
<td>WHOIS Server</td>
<td><?= $whoisClient->getServer() ?></td>
</tr>
<tr>
<td>Server Port</td>
<td><?= $whoisClient->getPort() ?></td>
</tr>
<tr>
<td colspan="2">
<pre><?= $whoisClient->getResponse(); ?></pre>
</td>
</tr>
</table>
</div>
<br>
</div>
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="well text-center">
<form style="margin: 10px;" action="" method="get">
<input type="text" name="tld" id="tld" value="list" hidden>
<input type="submit" value="Dominios Soportados" class="btn btn-lg btn-primary btn-block">
</form>
<?php if (isset($_GET["tld"]) && $_GET["tld"] == "list" ) : ?>
<?php foreach ($service->supportedTlds() as $tld) : ?>
<?= $tld; ?><hr>
<?php endforeach; ?>
<?php endif; ?>
</div>
<br>
</div>
<?php require_once 'templates/sidebar.php';?>
</div>
</div> <!-- /container -->
<?php require_once 'templates/footer.php';?>