百度知道有关php抓取问题
<?php
/**
desc:采集网页中的邮箱的代码
link:http://pc100.net
date:2013/2/24
*/
$url='http://pc100.net'; //要采集的网址
$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));
?>
http://zhidao.baidu.com/question/919359236196363019.html