From 337bd2bdf525f4c6d783faacaec4f4189daf1d57 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 24 Jun 2019 09:24:51 +0300 Subject: add basic wiktionary support --- backend.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'backend.php') diff --git a/backend.php b/backend.php index 4f4b402..4ed612b 100644 --- a/backend.php +++ b/backend.php @@ -231,6 +231,15 @@ break; + case "wikisearch": + $query = urlencode(strip_tags($_REQUEST['query'])); + $url = "https://en.wiktionary.org/w/api.php?titles=${query}&action=query&prop=extracts&format=json&exlimit=1"; + + if ($resp = file_get_contents($url)) { + print $resp; + } + + break; case "define": if (defined('DICT_ENABLED') && DICT_ENABLED) { -- cgit v1.2.3