$address, 'h' => $packed, 'v' => $version, ]); return; } if($reqPath === '/xml') { header('Access-Control-Allow-Origin: *'); header('Cache-Control: no-cache'); header('Content-Type: application/xml; charset=utf-8'); $document = new DOMDocument('1.0', 'utf-8'); $root = $document->appendChild(new DOMElement('IPAddress')); $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $root->setAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema'); $root->setAttribute('version', $version); $root->setAttribute('packed', $packed); $root->appendChild(new DOMText($address)); echo $document->saveXML(); return; } if($reqPath === '/packed') { header('Access-Control-Allow-Origin: *'); header('Cache-Control: no-cache'); header('Content-Type: text/plain'); echo $packed; return; } if($reqPath === '/') { header('Access-Control-Allow-Origin: *'); header('Cache-Control: no-cache'); header('Content-Type: text/plain'); echo $address; return; } } else { if($reqPath === '/style.css') { header('Content-Type: text/css; charset=utf-8'); echo file_get_contents(__DIR__ . '/../style.css'); return; } if($reqPath === '/script.js') { header('Content-Type: application/javascript; charset=utf-8'); echo file_get_contents(__DIR__ . '/../script.js'); return; } if($reqPath === '/') { header('Content-Type: text/html; charset=utf-8'); echo file_get_contents(__DIR__ . '/../index.html'); return; } } http_response_code(404); header('Content-Type: text/plain'); echo 'Path not found.';