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! Link to comment https://forums.phpfreaks.com/topic/76597-curl-dictionary/ 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 Link to comment https://forums.phpfreaks.com/topic/76597-curl-dictionary/#findComment-387907 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. Link to comment https://forums.phpfreaks.com/topic/76597-curl-dictionary/#findComment-387917 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 Link to comment https://forums.phpfreaks.com/topic/76597-curl-dictionary/#findComment-387925 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. Link to comment https://forums.phpfreaks.com/topic/76597-curl-dictionary/#findComment-908936 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. Link to comment https://forums.phpfreaks.com/topic/76597-curl-dictionary/#findComment-1048647 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.