Jump to content

cURL Dictionary


cursed

Recommended Posts

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

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

  • 1 year later...

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

  • 7 months later...

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.  8)

Link to comment
https://forums.phpfreaks.com/topic/76597-curl-dictionary/#findComment-1048647
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.