Home > php教程 > php手册 > body text

分享php如何抓取网页中邮箱地址代码

WBOY
Release: 2016-06-07 11:40:26
Original
1253 people have browsed it

分享php如何抓取网页中邮箱地址代码
php如何抓取网页中邮箱地址,下面我就给大家分享一个用php抓取网页中电子邮箱的实例。        <?php <br />         /** <br>         desc:采集网页中的邮箱的代码 <br>         link:www.jb100.net <br>         date:2013/2/24 <br>         */ <br>         $url='http://www.jb100.net'; //要采集的网址  <br>         $content=file_get_contents($url); <br>         //echo $content; <br>         function getEmail($str) { <br>         //$pattern = "/([a-z0-9]*[-_\.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?/i"; <br>         $pattern = "/([a-z0-9\-_\.]+@[a-z0-9]+\.[a-z0-9\-_\.]+)/"; <br>         preg_match_all($pattern,$str,$emailArr); <br>          <br>         return $emailArr[0]; <br>         } <br>         print_r( getEmail($content)); <br>         ?>  案例很简单,但是非常实用,需要的朋友可以参考一下。

AD:真正免费,域名+虚机+企业邮箱=0元

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template