-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.php
50 lines (38 loc) · 1.06 KB
/
status.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
<?php
/*
* https://www.wolnadomena.pl/status.php?domain=softreck.com
* http://localhost:8080/status.php?domain=softreck.com
*/
// Load composer framework
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require(__DIR__ . '/vendor/autoload.php');
}
use phpWhois\Whois;
require("apifunc.php");
header('Content-Type: application/json');
try {
$domain = $_GET['domain'];
// $domain = 'softreck.com';
if (empty($domain)) {
throw new Exception("domain is empty");
}
$domain = strtolower($domain);
apifunc([
'https://php.defjson.com/def_json.php'
], function () {
global $domain;
$whois = new Whois();
$result = $whois->lookup($domain, false);
echo def_json("", [
"status" => $result['regrinfo']['domain']['status'],
"domain" => $domain
]);
});
} catch (Exception $e) {
// Set HTTP response status code to: 500 - Internal Server Error
echo def_json("", [
"message" => $e->getMessage(),
"domain" => $domain
]
);
}