i have next script,
<?
function grab($id)
{
$result = '';
$page = implode('', file('./stranichki/'.$id));
if (preg_match_all('/download.cgi\?ID=(.*?)\">Download<\/a>/i',$page, $out)) { /* only <h0-9>-tags */
for($i=0;$i<sizeof($out[1]);$i++) {
print "<";
print "a href=\"ID=";
print $out[1][$i];
print "\">";
print $out[1][$i];
// print ">";
print "</a>";
print "<br>";
}
}
return $result;
}
$d = opendir('./stranichki/');
$res = '';
while (($e=readdir($d)) !== false)
{
if (($e != '.')&&($e != '..'))
{
$res .= grab($e);
}
}
$fi = fopen ('1.log', "w");
fwrite ($fi, $res);
?>
its grab text from file in stranichki page
and print result like:
<A
href="ID=21888">21888</A><BR><A
href="ID=19151">19151</A><BR><A
href="ID=21886">21886</A><BR>
.........
i need to have a result sorted by 1,2,3
and if grabed file has some dublicates,script must skip dublicate record in result.
please help