forked from MarkFirman/Oxford-Dictionaries-API-Wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
39 lines (32 loc) · 1.64 KB
/
Copy pathtest.php
File metadata and controls
39 lines (32 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/***********************************************************************
* # @Author Mark Firman
* # @Project Dictionary API V2
* # @Date 23/05/2019
* # @Email info@markfirman.co.uk
* # @Last Modified 24/05/2019
*/
/* Include the dictionary class */
include_once 'dictionary.class.php';
/* Create a new instance of the dictionary class */
$dictionary = new Dictionary("APP ID", "APP KEY", "en-gb");
/* Send new word request to the dictionary */
$dictionary->queryWord("Bark");
/* Set the result to use - some words might have multiple meanings - use this method to switch between different meanings */
/* This is only required if you want to specify a result set other than the default */
/* If you specify a result set that does not exist, it will default to 0 */
$dictionary->setResult(0);
/* Get results from dictionary class */
echo "<h1>Dictionary Class Results - ".$dictionary->getWord()."</h1>";
echo "<b>Word:</b> ".$dictionary->getWord();
echo "<br><b>Definition:</b> ".$dictionary->getDefinition();
echo "<br><b>Short Definition:</b> ".$dictionary->getShortDefinition();
echo "<br><b>Example:</b> ".$dictionary->getExample();
echo "<br><b>Lexical:</b> ".$dictionary->getLexical();
echo "<br><b>Phonetic:</b> ".$dictionary->getPhonetic();
echo "<br><b>Origin:</b> ".$dictionary->getOrigin();
echo "<br><b>Language:</b> ".$dictionary->getLanguage();
echo "<br><b>Audio:</b> <audio controls><source src='".$dictionary->getAudio()."' type='audio/mpeg'>Your browser does not support HTML audio</audio><br>";
/* Displays the current result set */
echo "<br></br>Using result set: <b>".$dictionary->selected_result."</b>";
?>