appendChild( $tb ); $tr = new Tr(); $hc1 = new Th(); $hc1->appendChild( new Text("Views") ); $hc2 = new Th(); $hc2->appendChild( new Text("URL" ) ); $tr->appendChild( $hc1 ); $tr->appendChild( $hc2 ); $tb->appendChild( $tr ); foreach ( $array as $line ) { $lineArray = preg_split("/\s+/",$line); if(count($lineArray)>=2){ $count = trim($lineArray[1]); $url = trim($lineArray[2]); $tr = new Tr(); $c1 = new Td(); $c1->appendChild( new Text($count) ); $c2 = new Td(); $a = new A(); $a->setHref("http://mark.kolich.com".$url)->setTarget("_blank")-> appendChild( new Text($url) ); $c2->appendChild( $a ); $tr->appendChild( $c1 ); $tr->appendChild( $c2 ); $tb->appendChild( $tr ); } } fclose( $fh ); echo $t->write(); ?>