cursed Posted November 9, 2007 Share Posted November 9, 2007 Hi, Is it possible for a script that can define a word using dictionary.com (or any dictionary website) when a user fills in a textbox with a word, the definition(s) will show in text on a separate page.However, the textbox can have one line per word, so it can define unlimited words. If so, can someone show an example? I looked through about 5 pages of cURL tutorials, nothing relating to finding something within a DIV or a certain criteria. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 9, 2007 Share Posted November 9, 2007 ajax and file_get_contents is what you need Quote Link to comment Share on other sites More sharing options...
cursed Posted November 9, 2007 Author Share Posted November 9, 2007 More info, (and an example) would be nice. I don't think I need ajax, I don't think my visitors would care that the page reloads when getting the information. Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 9, 2007 Share Posted November 9, 2007 i dont think it right to use the other site .. try to echo file('http://thesaurus.reference.com'); echo file_get_contents('http://thesaurus.reference.com'); it will print the site as text now all you need to do is add a query string eg... file('http://thesaurus.reference.com/page?teng=the value of your poast data here'); then get what you want trough regex Quote Link to comment Share on other sites More sharing options...
bonaparte Posted August 29, 2009 Share Posted August 29, 2009 You need this snippet to loopup the definition of the word 'camera' in the dict.org database. The script uses CURL with dict protocol. <?php $wordToLookup = 'camera'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "dict://dict.org/d:(" . $wordToLookup . ")"); $definition = curl_exec($ch); curl_close($ch); echo $definition; ?> You can also grab the script from Code Album repository - http://github.com/bngsudheer/Code-Album/blob/3a048318a679813013ef42de946f32b85c36e437/cli/scripts/standalone/CURL/LookupDictionary.php repository. Quote Link to comment Share on other sites More sharing options...
hookedonit Posted April 26, 2010 Share Posted April 26, 2010 We've just had a press release that mentions the Dictionary.com API. http://www.prnewswire.com/news-releases/dictionarycom-announces-10-million-mobile-downloads-new-app-for-ipad-accelerates-mobile-growth-momentum-92084104.html http://dictionary.reference.com/api/ There is an email address you can use to get more information and to be notified when it becomes available. I'll try and post more information to this thread I get and/or am allowed to provide. heh. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.