All pastes #906030 Raw Edit

Mine

public php v1 · immutable
·published 2008-02-16 06:44 UTC
rendered paste body
function parser($link, $level=0)	{		$contents = file_get_contents($link);		$regex = "#(h)[ ]*(r)[ ]*(e)[ ]*(f)[ ]*(=)[ ]*[\"\']{0,1}[\w:/\.?=_ %&\\-+]+[\"\'(/>)(>)]{0,2}#";		preg_match_all($regex, $contents, $out, PREG_SET_ORDER);		$regex_external_js = "#(<)[ ]*(s)[ ]*(c)[ ]*(r)[ ]*(i)[ ]*(p)[ ]*(t)[ ]*(t)[ ]*(y)[ ]*(p)[ ]*(e)[ ]*(=)[ ]*[\"\’](t)[ ]*(e)[ ]*(x)[ ]*(t)[ ]*(/)[ ]*(j)[ ]*(a)[ ]*(v)[ ]*(a)[ ]*(s)[ ]*(c)[ ]*(r)[ ]*(i)[ ]*(p)[ ]*(t)[ ]*[\"\']{0,1}[ ]*(s)[ ]*(r)[ ]*(c)[ ]*(=)[ ]*[\w/\.:/-+%&?’=\\_\"\' ]{4,}(>)#";		preg_match_all($regex_external_js, $contents, $matches, PREG_SET_ORDER);		for($i=0; $i< sizeof($matches); $i++) echo $matches[$i][0]."\n";		$nr_of_results = sizeof($out);		echo "Results ($nr_of_results links found):<br />";		for($i=0; $i< sizeof($out); $i++)		{			$out[$i][0] = str_replace("'", "", str_replace(">", "", str_replace("\"", "", str_replace("href=", "", str_replace(' ', '', $out[$i][0])))));			if(strpos($out[$i][0], "http://") === FALSE) $out[$i][0] = $link."".$out[$i][0];			echo ($i+1).". <a href='".$out[$i][0]."'>".$out[$i][0]."</a><br />";		}	}