[PHP] 如何用php抓取网页中邮箱地址代码 →→→→→进入此内容的聊天室

来自 , 2020-08-21, 写在 PHP, 查看 109 次.
URL http://www.code666.cn/view/54fe976b
  1.  <?php
  2.     /**
  3.     desc:采集网页中的邮箱的代码
  4.     link:www.pc100.net
  5.     date:2013/2/24
  6.     */
  7.     $url='http://www.pc100.net'; //要采集的网址  
  8.     $content=file_get_contents($url);
  9.     //echo $content;
  10.     function getEmail($str) {
  11.     //$pattern = "/([a-z0-9]*[-_\.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?/i";
  12.     $pattern = "/([a-z0-9\-_\.]+@[a-z0-9]+\.[a-z0-9\-_\.]+)/";
  13.     preg_match_all($pattern,$str,$emailArr);
  14.  
  15.     return $emailArr[0];
  16.     }
  17.     print_r( getEmail($content));
  18.     ?>
  19.  
  20. //php/9062

回复 "如何用php抓取网页中邮箱地址代码"

这儿你可以回复上面这条便签

captcha