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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.