i want to get and filtre emails from html code for each website in a textarea.
the problem is :when i put +3 urls in the list the code retu no email 0, but when i put -3 urls all be fine.
so my textarea is
<textarea type=text name="list" id="list" rows="32" cols="40"></textarea>
and my php code is
$textarea = str_replace("", "n", $_POST['list']);
$textarea = str_replace("r", "n", $textarea);
$textarea = explode("n", $textarea);
foreach ($textarea as $line) { //here i want to made a test for every url per line. when i test +3 urls it doesent work :(
if (preg_match('/^https?/', $line)) { //i want to check if the urls is valid
$text=file_get_contents($line);
$res = preg_match_all("/[a-z0-9]+[_a-z0-9.-]*[a-z0-9]+@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})/i",$text,$matches);
if ($res) {
foreach(array_unique($matches[0]) as $email) {
echo $email. "n";
}
}
}
}
i have some urls verified that retu emails for test, and when this list contien +3 urls it dosen't work, so my loop is incorrect or somethink. help me please. or another idea to extract emails from a list
