php抓取html的问题

软件和网站开发以及相关技术探讨
回复
cgk100
帖子: 60
注册时间: 2007-04-22 10:03
来自: china
联系:

php抓取html的问题

#1

帖子 cgk100 » 2007-11-23 16:52

我用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);



?>
头像
yiller
帖子: 47
注册时间: 2007-09-28 2:33
来自: 重庆

#2

帖子 yiller » 2007-11-25 3:06

老大 你要下服务器端代码啊? 除非你黑了它拿到SHELL 否则不可能
cgk100
帖子: 60
注册时间: 2007-04-22 10:03
来自: china
联系:

#3

帖子 cgk100 » 2007-11-25 8:20

我表达的有点问题呀 :(
回复