ok - heres the deal: for a college assignment we need to write an email spider which collects email addresses out of a text file... so - i just cant get a script to work well enough...
what i have so far is a pretty crappy workaround...
if ($inputString) {
$n = 0;
$inputString = stripslashes(str_replace("\"", "", str_replace(">", " > ", $inputString)));
$textArray = explode(" ", $inputString);
for ($i = 0; $i < count($textArray); $i++) {
$token = each($textArray);
$checkEmail = trim($token[value]);
$tokenPattern = "^(href=mailto:)";
if (eregi($tokenPattern, $checkEmail)) {
$checkEmail = str_replace("href=mailto_:_"_,_"_"_, $checkEmail);
//the mailto_:_"_,_"_"_ part is supposed to be WITHOUT THE UNDERSCORES
//this board parses that to a smilie code otherwise...
if (eregi($emailPattern, $checkEmail)) {
print "<INPUT TYPE=TEXT VALUE=\"$checkEmail\"><BR>";
$n++;
}
}
print "<BR><BR>$n found";
}
it sucks cos it only finds the emails in html files embedded in the mailto:... link structure...
what it SHOULD be able to do is find email addresses that are either between spaces or special characters like :;"<>#' etc.
so if somebody could get me a snippet to replace that id be glad about that...
each time the loop runs through $checkEmail should return a new email and the input text obviously is $inputString.
thanks in advance - sid
ps: no, i am not trying to get into the bulk email business ;-)