Copy code The code is as follows:
$url='http://www.jb51.net' ; //This page definitely contains an email address.
$content=file_get_contents($url);
//echo $content;
function getEmail($str) {
//$pattern = "/([a-z0-9]* [-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2, 3}([.][a-z]{2})?/i";
$pattern = "/([a-z0-9-_.]+@[a-z0-9]+.[a -z0-9-_.]+)/";
preg_match_all($pattern,$str,$emailArr);
return $emailArr[0];
}
print_r( getEmail($content));
?>
http://www.bkjia.com/PHPjc/325632.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325632.htmlTechArticleCopy the code as follows: ?php $url='http://www.jb51.net'; // This page definitely contains an email address. $content=file_get_contents($url); //echo $content; function getEmail($str)...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn