Home > Backend Development > PHP Tutorial > PHP code to capture email addresses in web pages

PHP code to capture email addresses in web pages

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 09:04:42
Original
938 people have browsed it
  1. /**

  2. desc: code to collect the mailbox in the web page
  3. link: bbs.it-home.org
  4. date: 2013/2/24
  5. */
  6. $url='http://bbs.it-home.org'; //This page definitely contains an email address .
  7. $content=file_get_contents($url);
  8. //echo $content;
  9. function getEmail($str) {
  10. //$pattern = "/([a-z0-9]*[-_.]?[a -z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z ]{2})?/i";
  11. $pattern = "/([a-z0-9-_.]+@[a-z0-9]+.[a-z0-9-_.]+) /";
  12. preg_match_all($pattern,$str,$emailArr);

  13. return $emailArr[0];

  14. }
  15. print_r( getEmail($content));
  16. ?>< ;/p>
Copy code


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