note 33704 deleted from index by alindeman

From: Date: Fri, 04 Jul 2003 16:31:11 +0000
Subject: note 33704 deleted from index by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-51521@lists.php.net to get a copy of this message
Note Submitter: phpcontrib [ A T ] esurfers ° com ---- When adding your eMail address to contributed PHP manual notes, do not standardize on common antispam tecniques like adding NOSPAM or writing AT instead of @! Invent your own fancy style! The more you standardize, the more a bot that scans the pages will be easy to build! Don't trust me? This was a quick hack, it will scan 100 pages starting from the PHP manual page for function preg-match-all(), following links to other pages and collecting all emails... Of course if will substitute AT with @ and remove all NOSPAM and similar keywords.. :) be careful!!!!!!! It will collect 800 eMails of PHP programmers (probably including mine, ouch!!!) on 100 pages. Most of them valid. Francesco -------------------------------------- <?php set_time_limit (60*3); // Three minutes or adjust to your computer/net speed $PageName="function.preg-match-all.php"; $PageBase="http://www.php.net/manual/en/"; // no complex path handling just get pages inside here $CollectedLinks=array($PageName); $DoneLinks=array(); $MaxIters=100; $CountEmails=0; $CountPages=0; echo("<p><h1>Collecting $MaxIters pages starting from \"$PageName\" at $PageBase</h1></p>"); while(count($CollectedLinks)>0 && $MaxIters>0) { $PageUrl=array_pop ($CollectedLinks); if(array_search($PageUrl,$DoneLinks)<1) { $MaxIters--; echo('<p><font color=lightGrey>From <b>'.$PageBase.$PageUrl.'</b></font></p>'); SuckPage($PageBase.$PageUrl); flush(); $CountPages++; array_push($DoneLinks,$PageUrl); } } echo('<p><b>Total eMails collected: '.$CountEmails.' on '.$CountPages.' pages</b></p>'); function SuckPage($PageName) { global $CollectedLinks,$DoneLinks,$CountEmails; //echo("<br>$PageName<br>"); $PageArr=@file($PageName); if($PageArr!=null && count($PageArr)>1) { $Page=implode('',$PageArr); $NospamWords=array('no spam','no-spam','nospam','spam','no','remove', 'stop','kill','fucking','skipthisword','skip this', 'skip-this','skipthis','fucking','fuck','kill.webbots.com', 'user@domain.tld'); $Page=str_replace(' at ','@',$Page); $Page=str_replace(' AT ','@',$Page); $Page=str_replace(' dot ','.',$Page); $Page=str_replace(' DOT ','.',$Page); $Page=str_replace('(at)','@',$Page); $Page=str_replace('(AT)','@',$Page); $Page=str_replace('°','.',$Page); $Page=str_replace('DOT','.',$Page); foreach($NospamWords as $NSWord) { $Up=strtoupper($NSWord); $NSCombi=array( ' '.$NSWord.' ', ' '.$NSWord, $NSWord.' ', $NSWord, ' '.$Up.' ', ' '.$Up, $Up.' ', $Up ); foreach($NSCombi as $NSRepl) { $Page=str_replace($NSRepl,'',$Page); } } $eMails=Array(); $Links=Array(); preg_match_all( "/[a-zA-Z.,_#1-9,]+@[-a-zA-Z,_#1-9,]*(\.[-a-zA-Z,_#1-9,]+)+/", $Page, $eMails); foreach ($eMails[0] as $loop_result) { if($Links[0][$i]!="search@") { echo "<a href=\"mailto:$loop_result\">$loop_result</a><p>\n"; $CountEmails++; flush(); } } preg_match_all("|href=\"?([^\"' >]*function\.[^\"' >]+\.php)|i", $Page, $Links); $CleanLinks=array(); for($i=0;$i<count($Links[0]);$i++) { if(strpos($Links[0][$i],'http')!==false) { continue; } $Links[0][$i]=str_replace('HREF="/','',$Links[0][$i]); $Links[0][$i]=str_replace('href="/','',$Links[0][$i]); $Links[0][$i]=str_replace('HREF="','',$Links[0][$i]); $Links[0][$i]=str_replace('href="','',$Links[0][$i]); if(array_search($Links[0][$i],$DoneLinks)<1 && array_search($Links[0][$i],$CollectedLinks)<1) { $CleanLinks[]=$Links[0][$i]; } } $CollectedLinks=array_merge($CleanLinks,$CollectedLinks); } } ?>

« previous php.notes (#51521) next »