diff options
author | Andrew Dolgov <[email protected]> | 2019-06-24 09:24:51 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-06-24 09:24:51 +0300 |
commit | 337bd2bdf525f4c6d783faacaec4f4189daf1d57 (patch) | |
tree | b59111ff9dda2a45b30dda42f31805f753bd6448 /backend.php | |
parent | 6bbce144df1e35a4844afbbf10735ddecbe81819 (diff) |
add basic wiktionary support
Diffstat (limited to 'backend.php')
-rw-r--r-- | backend.php | 9 |
1 files changed, 9 insertions, 0 deletions
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) { |