All pastes #157708 Raw Edit

Untitled

public php v1 · immutable
·published 2006-09-01 18:52 UTC
rendered paste body
<?php	set_time_limit(500);	require_once("hserv.php");	$h = fopen("htmlref.com.txt","r");	$d = fread($h,filesize("htmlref.com.txt"));	fclose($h);	$d = preg_replace("/\n/","",$d);	preg_match_all("/<a href=\"reference\/app.\/.+?\">.+?<\/a>/im",$d,$r);		//	remove unwanted	unset($r[0][0]);		unset($r[0][108]);	unset($r[0][211]);	unset($r[0][212]);	unset($r[0][214]);	unset($r[0][215]);	unset($r[0][216]);	unset($r[0][217]);	unset($r[0][213]);		//check and remove duplicates	$r[0] = array_unique($r[0]);	foreach($r[0] as $key=>$match){		// $m[2] = tag, $m[1] = url, 0 = whole		preg_match("/<a href=\"(reference\/app.\/.+?)\">(.+?)<\/a>/i",$match,$m);		//connect to the page for the current tag		$conn = new HServ("www.htmlref.com");		$data = $conn->http_request("get", $m[1]);				//create array with name of the current tag		${$m[2]} = array();		array_push(${$m[2]},"Title");														// ${$m[2]}[0]		array_push(${$m[2]},"Description");											// ${$m[2]}[1]		array_push(${$m[2]},"Compatability");										// ${$m[2]}[2]		array_push(${$m[2]},"Example");													// ${$m[2]}[3]		array_push(${$m[2]},"http://www.htmlref.com/".$m[1]);		// ${$m[2]}[4]				$line =  "INSERT INTO html_ref(tag,title,description,compatability,example,uri) VALUES('".$m[2]."','".${$m[2]}[0]."','".${$m[2]}[1]."','".${$m[2]}[2]."','".${$m[2]}[3]."','".${$m[2]}[4]."')";		$line.="<br />";		echo $line;		//echo "Description for &quot;".$m[2]."&quot; : ".${$m[2]}[0]."<br />";		//echo $data; exit;		//echo $key." => ".$m[2]." - <a href=\"http://www.htmlref.com/".$m[1]."\" target=\"_blank\">".$m[1]."</a><br />";	}	//var_dump($table);?>