<?php
ob_start();
include('http://news.sohu.com/20041027/n222706530.shtml');
$string=ob_get_contents();
preg_match("/新快报讯(.*)<sohu_cms_include\:sohu_news_cs_text>/Uis",$string,$matches);
$content=$matches[1];
ob_end_clean();
echo $content;
?>

解决方案 »

  1.   

    哦,忘记去掉新闻里的HTML了~重写了一个
    <?php
    ob_start();
    include('http://news.sohu.com/20041027/n222706530.shtml');
    $string=ob_get_contents();
    preg_match("/新快报讯(.*)<sohu_cms_include\:sohu_news_cs_text>/Uis",$string,$matches);
    $content=$matches[1];
    $content=preg_replace("/<script.*<\/script>/U","\n",$content);
    $content=preg_replace("/<.*>/U","\n",$content);
    ob_end_clean();
    echo $content;
    ?>
      

  2.   

    这样是不是更快呢?
    <?php
    ob_start();
    include('http://news.sohu.com/20041027/n222706530.shtml');
    $string=ob_get_contents();
    preg_match("/新快报讯(.*)<sohu_cms_include\:sohu_news_cs_text>/Uis",$string,$matches);
    $content=preg_replace("/<script.*<\/script>/U","\n",$matches[1]);
    $content = strip_tags($content);
    ob_end_clean();
    echo $content;
    ?>