网页里有的页面夹杂了一下邮件地址,我如何用php把里面的所有邮件地址的抽取出来类似如下
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>[email protected]</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>[email protected]</td>
</tr>
</table>
<div><a href="mailto:ccc@163com">ccc@163com</a></div>
</body>
我需要程序自动处理后得到如下邮件地址
[email protected]
[email protected]
ccc@163com
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>[email protected]</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>[email protected]</td>
</tr>
</table>
<div><a href="mailto:ccc@163com">ccc@163com</a></div>
</body>
我需要程序自动处理后得到如下邮件地址
[email protected]
[email protected]
ccc@163com
各家免费邮件提供商,用户名规则好像略有差异。preg_match_all('#[\w][\w.-]+[\w]@([\w-]+\.)+\w+#', $html, $m);
$res = array_unique($m[0]);
print_r($res);