mirror of
https://github.com/NotMikeDEV/DoH
synced 2024-11-21 15:13:34 +00:00
26 lines
808 B
PHP
Executable File
26 lines
808 B
PHP
Executable File
<?php
|
|
if (isset($_SERVER['CONTENT_TYPE']) && $_SERVER['CONTENT_TYPE'] == 'application/dns-message')
|
|
{
|
|
$request = file_get_contents("php://input");
|
|
header("Content-Type: application/dns-message");
|
|
$s = fsockopen("udp://127.0.0.1", 53, $errno, $errstr);
|
|
if ($s)
|
|
{
|
|
fwrite($s, $request);
|
|
echo fread($s, 4096);
|
|
fclose($s);
|
|
}
|
|
}
|
|
else if (isset($_GET['dns']))
|
|
{
|
|
$request = base64_decode(str_replace(array('-', '_'), array('+', '/'), $_GET['dns']));
|
|
header("Content-Type: application/dns-message");
|
|
$s = fsockopen("udp://127.0.0.1", 53, $errno, $errstr);
|
|
if ($s)
|
|
{
|
|
fwrite($s, $request);
|
|
echo fread($s, 4096);
|
|
fclose($s);
|
|
}
|
|
}
|