All pastes #767953 Raw Edit

Graham

public php v1 · immutable
·published 2007-11-10 03:50 UTC
rendered paste body
function bash($id = NULL) {	if (!$id) {		$random = file_get_contents("http://bash.org/?random");		$random = str_replace("\n", "", $random);		preg_match("/title=\"Permanent link to this quote.\"><b>(.*?)<\/b>/", $rand, $id);		$id = str_replace("#", "", $id[1]);	}	$html = file_get_contents("http://www.bash.org/?quote=$id");	$html = str_replace("\n", "", $html);	preg_match("/<font class=\"bodytext\">(.*?)<\/font>/i", $html, $error);	preg_match("/<p class=\"qt\">(.*?)<\/p>/i", $html,$quote);	$quote = strip_tags($quote[1]);	$quote = str_replace("\r", "\n", $quote);	if ($error) { 		return $error[1];	} else {		return $quote;	}}