21,887
社区成员
发帖
与我相关
我的任务
分享
<?php
$str = file_get_contents("http://www.baidu.com/s?wd=google&ch=&tn=360se_dg&bar=");
$reg="/[\s\S]*?<td\sclass=f>((?:(?!<\/td>)[\s\S])+)<\/td>(?:(?!<td\sclass=f>)[\s\S])+/i";
preg_match($reg,$str,$match);
//echo htmlspecialchars($match[0]);
$reg2="/<\/?(?:(?!br|>)[\s\S])+[^>]*>/i";
$text = preg_replace($reg2,"",$match[0]);
$reg3="/(?:<br>(?:(?!<br>).)*){2}★/i";
$text = preg_replace($reg2,"<br />",$text);
echo $text;
?>