From d1dcd0b49010bba31e44859e0d1d76abb7fb20fc Mon Sep 17 00:00:00 2001 From: Maksymilian Jopek Date: Tue, 15 Feb 2022 20:42:04 +0100 Subject: Initial commit - v1.0.0 --- index.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 index.php (limited to 'index.php') diff --git a/index.php b/index.php new file mode 100644 index 0000000..a67bd26 --- /dev/null +++ b/index.php @@ -0,0 +1,24 @@ +xpath('//row/NAZWA_DOD[text()="województwo"]/ancestor::*/NAZWA/text()'); + $result = $xml->xpath('//NAZWA_DOD[text()="województwo"]/ancestor::*/NAZWA/text() | //NAZWA_DOD[text()="województwo"]/ancestor::*/WOJ/text()'); +} else if ($method === "POST") { + $body = file_get_contents('php://input'); + // echo $body; + // echo '//row/NAZWA[text()="' . $body . '"]/ancestor::*/NAZWA_DOD[contains(text(),"miejs")]/ancestor::*/NAZWA/text()'; + $result = $xml->xpath('//row/WOJ[text()="' . $body . '"]/ancestor::*/NAZWA_DOD[contains(text(),"miejs")]/ancestor::*/NAZWA/text()'); +} else { + $result = $xml->xpath('//row/NAZWA[text()="ŁÓDZKIE"]/ancestor::*/NAZWA_DOD[contains(text(),"miejs")]/ancestor::*/NAZWA/text()'); + $result = $xml->xpath('//WOJ[text()="10"]/ancestor::*/NAZWA_DOD[contains(text(),"miejs")]/ancestor::*/NAZWA/text()'); + $result = $xml->xpath('//NAZWA_DOD[text()="województwo"]/ancestor::*/NAZWA/text() | //NAZWA_DOD[text()="województwo"]/ancestor::*/WOJ/text()'); +} +$result = array_map(function ($x) { + return "$x"; +}, $result); +echo json_encode($result); +// print_r($result); -- cgit v1.3.1