当前位置:编程学习 > php >>

实用PHP网页抓取

<html>
<head>
  <title>PHP 网页抓取测试</title>
</head>
<body  >
<?php echo ''<p>Hello World!</p>''; ?>
<table>
<tr>
<td>
sssss
</td>
<td>
ooooo
</td>
</tr>
</table>
</body>
</html>  

 

 

<html>
<head>
<title>实用抓取网页内容测试 </title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body  >
<?php
$url = ''http://localhost/test.php''; //测试本地网页
#$url = ''http://www.myenjoylife.cn/index.php''; //抓取www.myenjoylife.cn首页内容
$lines_array = file($url);
$lines_string = implode('''', $lines_array);
eregi("(.*)", $lines_string, $head);
echo $head[0];
?>
</body>
</html>

 

http://blog.csdn.net/hongyu6/archive/2008/03/11/2170585.aspx



补充:Php教程,Php常用代码

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,