php 获取网页内容及代码
2010-07-23 10:47
561 查看
<?php $url = "http://localhost/cp/test.html"; $contents = file_get_contents($url); //如果出现中文乱码使用下面代码 $getcontent = iconv("gb2312", "utf-8",$contents); echo $getcontent; ?>
<?php $lines = file('http://localhost/cp/test.html'); foreach ($lines as $line_num => $line) { echo "Line <b>{$line_num}</b> : " . htmlspecialchars($line). "<br />/n"; } ?>
相关文章推荐
- PHP 获取远程网页内容的代码(fopen,curl已测)
- PHP 获取远程网页内容的代码(fopen,curl已测)
- 分享几段获取远程网页内容的php代码。
- [PHP代码] PHP远程获取网页内容
- libcurl获取网页内容的PHP代码
- php获取网页内容方法总结
- 获取网页内容(不登录_PHP&.NET)
- php获取网页内容
- php通过网页地址获取该地址下的内容
- php获取网页标题和内容函数(不包含html标签)
- 使用php获取网页内容
- PHP中使用curl库获取网页内容如何P…
- PHP 正则表达式 获取网页charset 编码 ,可以获取任意网页charset(代码备份)
- php获取网页标题和内容函数(不包含html标签)
- php中抓取网页内容的代码
- php获取网页内容
- PHP获取网页内容
- php获取网页中图片、DIV内容的简单方法