Very simple thing. I sometimes want to access urban dictionary but it is blocked where I am. Given a form like
<form method="get" action="<?PHP echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
<input type="text" name="what" value="" />
<input type="submit" />
</form>
what do I need to add to have it return the content of the entry from urban dictionary for value entered? For example using CURL or getFile or something as simple as possible
Update:
This works!
<form method="get" action="">
<input type="text" name="what" value="" />
<input type="submit" />
</form>
<?PHP
$what = isSet($_GET["what"])?htmlentities($_GET["what"]):"";
echo file_get_contents("http://www.urbandictionary.com/define.php?term=".urlencode($what));
?>
very simple, very weird file_get_contents($_POST['what']);
Maybe you are looking for something like http://pici.picidae.net/ rather than programming something which will be blocked by your network anyway.
You need to do some DOM parsing with PHP. You can use the native DOM parser in PHP5 (recommended, see here http://www.ibm.com/developerworks/library/os-xmldomphp/), or a library like Simple HTML DOM Parser (http://simplehtmldom.sourceforge.net/).
You can then use your post data to choose the URL.