<?php
//目标主站
$barurl="http://www.baidu.com";
//获取采集网页内容
$content=book_geturldata($_GET['url']."?see_lz=1&pn=".$_GET['page'],$barurl);
//获取贴子主题
$preg='/<h1 class="core_title_txt" title="(.*)">(.*)<\/h1>/';
preg_match($preg, $content, $zt);
$theme=html_replace($zt[2]);
//计算发贴时间
$zttime[0]=date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s'))+$core_time*3600);
//获取贴子内容
$contentpost = split("</cc><br/> </div>", $content);
for ($count=0;$count<(count($contentpost)-1);$count++)
{
  $preg='/<div id="post_content_(.*?)" class="d_post_content j_d_post_content ">(.*[\s\S]+?)<\/div>/';
  preg_match($preg, $contentpost[$count], $rs);
  $contents[$count]=$rs[2];
  $preg='/<img(.*?)src="(.*?)"(.*?)>/';
  $zttime[$count+1]=date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s'))+$core_time*3600);
  if($_GET['bendihua']=="1")
  {
    preg_match_all($preg, $contents[$count], $tp);
    for($j=0;$j<count($tp[2]);$j++)
    {
      if(!isset($tupian) or $tupian[$count]=="")
	    $tupian[$count]=$tp[2][$j];
	  else
        $tupian[$count]=$tupian[$count]."|".$tp[2][$j];
    }
  }
  $contents[$count]=preg_replace($preg,'[img]\\2[/img]',$contents[$count]);
  $preg='/<a href="(.*)"  onclick="Stats\.sendRequest\(\'fr=tb0_forum&st_mod=pb\&st_value=atlink\'\)\;" onmouseover="showattip\(this\)" onmouseout="hideattip\(this\)" username="(.*)" target="_blank" class="at">(.*)<\/a>/';
  $contents[$count]=preg_replace($preg,'\\3',$contents[$count]);
  $preg='/<a href="(.*)"  target="_blank">(.*)<\/a>/';
  $contents[$count]=preg_replace($preg,'\\2',$contents[$count]);
  $contents[$count]=str_replace("</div></cc><br/>","",$contents[$count]);
  $contents[$count]=str_replace("	","",$contents[$count]);
  $contents[$count]=str_replace('<br>',chr(13),$contents[$count]);
  $contents[$count]=nl2br(html_replace(autolink($contents[$count])));
  $contents[$count]=str_replace('<br />','',$contents[$count]);
}
//$theme-主题  $zttime-发贴时间  $tupian-图片
?>