Collect the php code of the email (grab the email address in the web page)

高洛峰
Release: 2023-03-02 15:56:01
Original
1275 people have browsed it

Copy the code The code is as follows:

<?php 
$url=&#39;http://www.bitsCN.com&#39;; //这个网页里绝对含有邮件地址。 
$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)); 
?>
Copy after login


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!