-
Notifications
You must be signed in to change notification settings - Fork 0
/
hs.php
39 lines (33 loc) · 984 Bytes
/
hs.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
<?php
class response {
public $isSucess = false;
public $des = "";
public $resData = "";
}
$rsp = new response();
$dnsIP = "8.8.4.4";
$dnsPort = 53;
$postData = file_get_contents("php://input");
$base64decode = base64_decode($postData);
$dnsSocket = socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
$sendCount = socket_sendto(
$dnsSocket,
$base64decode,
strlen($base64decode),
0,
$dnsIP,
$dnsPort
);
socket_recvfrom(
$dnsSocket,
$result,
512,
0,
$dnsIP,
$dnsPort
);
$rsp->isSucess = true;
$rsp->des = "sucess";
$rsp->resData = base64_encode($result);
echo json_encode($rsp);
?>