All pastes #729786 Raw Edit

Stuff

public php v1 · immutable
·published 2007-10-08 10:03 UTC
rendered paste body
<?php$get = addslashes($_GET['term']); // The term to define$num = addslashes($_GET['num']) + 1; // The definition number.$num2 = addslashes($_GET['num'])$newget = str_replace(" ", "%20", $get); // Replace spaces in the URL with %20.if ($_GET['term'] == '' || $_GET['term'] == ' ' || $_GET['term'] == null) { // If term is not defined, do this:	echo "you need to define a word. Use as: define.php?term=word";			 // Echo this message.} else { // If term is defined, do this:	$html = file_get_contents("http://www.urbandictionary.com/define.php?term=" . $newget . "");	// Open the website URL, with the specified term.	$html = str_replace("\n", "", $html); // Replace breaks with nothing.	preg_match("/<div class=\"def_p\">(.*?)<\/div>/", $html, $quote); // Search for where the definition starts to be defined in the website.	$ex = explode("</p>", $quote[$num]); // Get rid of the </p>	$d = trim(strip_tags($ex[$num2])); // Trim up the definition.	$e = trim(strip_tags($ex[$num])); // Trim up the example.	echo "Definition: "; // Echo	echo $d; // Echo the Definition	echo " Example: "; // Echo	echo $e; // Echo the Example}?>