Collect email php code

WBOY
Release: 2016-07-25 09:06:35
Original
801 people have browsed it
Since I made a program for sending mass emails, of course it couldn’t be done without an email address, so I wrote a program to collect email addresses.
Reprinted from:
http://www.tongqiong.com/read.php?tid-35-ds-1.html
  1. //Author: www.tongqiong.com
  2. $url='http://www.tongqiong.com/read.php?tid-1-ds-1.html'; // This page definitely contains an email address.
  3. $content=file_get_contents($url);
  4. //echo $content;
  5. function getEmail($str) {
  6. //$pattern = "/([a-z0-9]*[-_.]?[a -z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z ]{2})?/i";
  7. $pattern = "/([a-z0-9-_.]+@[a-z0-9]+.[a-z0-9-_.]+) /";
  8. preg_match_all($pattern,$str,$emailArr);
  9. return $emailArr[0];
  10. }
  11. print_r( getEmail($content));
  12. //Author: www.tongqiong.com
  13. ?>
Copy code


Related labels:
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!