function api_english($word) { if (!$word) { return false; } $xdef = grab_xml_definition($word, "learners", "8d097dd0-9e82-4484-abf9-404a999e3c1b"); return simplexml_load_string($xdef); }
function dictionaryThing($res) { echo "[mayumi server word]" . $_GET['word'] . "[/mayumi server word]" . grab_xml_definition($_GET['word']); }
<?php $word = $_GET["word"]; //print_r($word); // This function grabs the definition of a word in XML format. function grab_xml_definition($word, $ref, $key) { $uri = "http://www.dictionaryapi.com/api/v1/references/" . urlencode($ref) . "/xml/" . urlencode($word) . "?key=" . urlencode($key); header('Content-type: text/xml'); echo file_get_contents($uri); } $xdef = grab_xml_definition($word, "thesaurus", "02194a6a-435e-44cd-8319-c67037178fcb");