|
|

楼主 |
发表于 2010-9-17 08:57:37
|
显示全部楼层
下面为采集页面的 html;- <?php
- //字符串过滤HTML
- function replace_HTML($start, $end, $str)
- {
- $temp = explode($start, $str, 2);
- $content = explode($end, $temp[1], 2);
- return $content[0];
- }
-
- $html=iconv('gbk','gbk',file_get_contents('http://www.163.com'));
- //获取网站HTML,并且转换网站字符偏码 参数1为获取网站,参数2为本地的
- //下面为实例示范;
- echo '采集内容:'.preg_HTML('<title>','</title>',$html);
- ?>
复制代码 |
|