我写了一些代码来查找电子邮件地址表单链接。链接存储在data.txt文件中。我不能这么做。有人可以帮忙吗?
<?php
$url=file("data.txt");
foreach ( $url as $key => $value) {
$text=file_get_contents($value);
$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 . "<br />";
}}
else {
echo "No emails found.";
}
}
?>