solq360 发表于 2010-9-17 06:35:48

php 简单采集页面源代码

code]<?php
        //字符串过滤HTML
        function replace_HTML($start, $end, $str)      
        {      
          $temp = explode($start, $str, 2);      
          $content = explode($end, $temp, 2);      
          return $content;      
        }   
        $html=iconv('gbk','gbk',file_get_contents('http://www.163.com'));
       //获取网站HTML,并且转换网站字符偏码 参数1为获取网站,参数2为本地的

        //下面为实例示范;
        echo '采集内容:'.preg_HTML('<title>','</title>',$html);
?>
页: [1]
查看完整版本: php 简单采集页面源代码