Ok I'm trying to dump a dmoz category and all sub categories to a text file, I got it doing the first category. But now how do I get it to index all sub cateogries?
<?
// obsolute path of the file.
$filename = 'http://dmoz.org/business';
$data = @join ('' , file ($filename));
$textfile = 'test.txt';
$pos = 0;
while ($pos < strlen($data)-1) {
$pos = strpos($data,"<",$pos);
$pos++;
$lastpos = strpos($data,">",$pos);
$tag = substr($data,$pos,$lastpos-$pos);
if (!strcasecmp(strtok($tag," "),"A")) {
$pos = $lastpos+1;
$linkpos = $pos;
$pos = strpos($data,"<",$pos);
$link = substr($data,$linkpos,$pos-$linkpos);
$links[] = trim($link);
if (eregi("HREF[ \t\n\rv]*=[ \t\n\rv]*[\"']*([^\"']*)[\"']*",$tag,$regs)) {
$urls = $regs[1];
} else {
$urls = "";
}
$sub= substr($urls,0,9);
if($sub=='/Business')
{
echo $urls."<BR>";
$str=substr($urls,0,7);
if($str=='http://')
{
$url=$urls;
}
else
{
$url="$filename".$urls;
}
} }
$pos = $lastpos+1;
}
?>