php编程:突破防采集,用php代码获取 一个网页的内容

目标网页shenyang.liebiao.com/qitashenghuo/55349766.html注意以下方法都不行注意以下方法都不行file_get_content... 目标网页
shenyang.liebiao.com/qitashenghuo/55349766.html

注意以下方法都不行
注意以下方法都不行
file_get_contents

function curlGetHtml($url){
$userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)';//模仿IE浏览器
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:8.8.8.8', 'CLIENT-IP:8.8.8.8')); //构造IP
curl_setopt($ch, CURLOPT_REFERER, 'http://www.baidu.com/');// 设置选项,来源页,这意味着可以伪造referer达到某种目的
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); //是否显示内容 1 不显示;0 显示(默认)
curl_setopt($ch, CURLOPT_TIMEOUT, 10); //延续多少秒
$html = curl_exec($ch);
curl_close($ch);
if (!$html)
{
$html = false;
}
return $html;
}
展开
 我来答
百度网友a5fcb3ef4
2013-04-19 · 超过83用户采纳过TA的回答
知道小有建树答主
回答量:170
采纳率:100%
帮助的人:235万
展开全部
<?php
$url = '网址';
$str = gzinflate(substr(file_get_contents($url),10,-8));
echo $str;
?>

目标网址gzip 压缩等级高了,要解密

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式