stbyruby 发表于 2017-3-22 06:35:15

实用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;
?>
</body>
</html>
  http://blog.csdn.net/hongyu6/archive/2008/03/11/2170585.aspx
页: [1]
查看完整版本: 实用PHP网页抓取