.+?<\/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>/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.="
"; echo $line; //echo "Description for "".$m[2]."" : ".${$m[2]}[0]."
"; //echo $data; exit; //echo $key." => ".$m[2]." -
".$m[1]."
"; } //var_dump($table); ?>