Search code examples
jsondictionarythesaurus

get all meanings of a word in json


How can I get all meaning of a word in json response .Preferably without key/signing up/api key .If I type test then all meaning of that word.

I tried :

but its not working.

<?php
$query = 'oracle';
$file = file_get_contents('http://www.google.com/dictionary/json?callback=a&q='.$query.'&sl=en&tl=en&restrict=pr,de&client=te');
// var_dump($file);
$file = substr($file, 2, -10);
$file = preg_replace("/\\\x[0-9a-f]{2}/", "", $file);
echo $file;
$json = json_decode($file);
var_dump($json);
?>

Even this is returning null.

I have tried Only the php above.I would like to knowif I can make rest call without api key just words which match the query word .Is there any rest call you have in mind.I really appreciate any help .Thanks in Advance.


Solution

  • Assuming server side

    Get a copy of a dictionary in a computer friendly format i.e. http://www.ibiblio.org/webster/ (XML). Store said dictionary in a database or in memory and perform a lookup.

    Would then be trivial to provide a restful service returning all definitions for a particular word.

    Also see: Google's "define: " through an API?