抓网站内容的工具

 

<?
/*
Distribut this program freely as boring as you want :) be sure distribute as GPL (GENERAL PUBLIC LICENSE)

Modify it by your own gewd but keep the name bellow.
Thanks to:
- My God
- My Wife ( dessy )
- My friends at satunet.com
- My Stivi "master your perl is good teachme master!" :)
- Murali Balreddy <muralib_ at_hotmail_dot_com_NO_SPAMMING_HIM!_please> for his report

Versi 2,
without using any CACHE! */

// this version II will handel error message IF the target site DOWN!
// thanks to Murali Balreddy <muralib_ at_hotmail_dot_com_NO_SPAMMING_HIM!_please> for his report
// this one for you man :)

//begin add
$fp = fsockopen("kafegaul.com", 80, &$errno, &$errstr, 30);
if(!$fp) {
echo "site down!! no information can be stole!!<br>\n";
exit;
} else {
// end add
$file=fopen("http://kafegaul.com/board/forumdisplay.cgi?action=topics&number=15&SUBMIT=Go","r");
if (!$file) {
echo "error when connect\n";
exit;
}
while (!feof($file)) {
$line = fgets($file,1024);
if (eregi("<A HREF=\"http://kafegaul.com/board/ubbhtml/Forum15/HTML/(.*)</A>", $line, $out)){
$i++;
if ($i > 3 ) { break; }
print "<tr><td width=\"100%\" align=\"center\" bgcolor=\"#C0C0C0\"><p align=\"left\"><small><strong><font face=\"Arial\"><A HREF=\"http://www.kafegaul.com/board/ubbhtml/Forum15/HTML/$out[1]</a></font></strong></small></td></tr>";
}
}
fclose($file);

//begin add
}
//end add
?>