我用php做了抓取一个网站的html,以下是代码,但是得到的html,都是客户端的html,也就是在ie中右键查看源代码的这种html,我想得到服务器端的html,请问php中抓取网页html的其他函数,有没有不是如此的原理的呢?
我也用了curl,fopen但是都是客户端的html。
<form id="form" method="POST" action="gethtml.php">
url:<input type="text" name="url">
<input type="submit" >
</form>
<?php
@$url=$_POST['url'];
if ($url=='')
{ echo 'please enter url';
exit;
}
$str=file_get_contents($url);
if ($str===false)
{
echo 'get content failed';
exit;
}
echo htmlspecialchars($str);
?>
php抓取html的问题
-
- 帖子: 60
- 注册时间: 2007-04-22 10:03
- 来自: china
- 联系: