php 收罗器

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<?php
set_time_limit(0);
?>
<html xmlns=”;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″
/>
<title>无标题文档</title>
</head>

<body>
<?php

 $filecontent = getcontent(”);
 $start = ‘s;
 $end =’b;
 $art = 311;
 $str = ”;

 preg_match(‘/<title>(.+?)</title>/’, $filecontent,
$arr);/* 取得标题*/
  $init =explode($start,$filecontent); 
 $array = explode($end,$init[1]);
 $str =$str.$arr[1].replaceHtml($array[0]);

function getcontent($url)
 {  
  $retmsg=file_get_contents($url);
  return $retmsg;
 }

function savato($filename,$content){
 if( !empty( $content ) ){
  $info = fopen($filename,’w+’);
  fwrite($info,$content);
  fclose($info);
  echo “保存文件 $filename 成功<br>”;
 }else{
  echo ‘文章更新失败,<a href=get.php >点击重新更新</a>’;
 }
}

function replaceHtml($str){
 $temp = str_replace(‘ ‘,’ ‘,$str);
 $temp = str_replace(‘<BR>’,chr(10),$temp);
 $ return strip_tags($temp);
 }
 

 ?>
</body>
</html>

相关文章