怎样抓取discuz防采集网页?? 如:http://www.expreview.com/39435.html在本地服务器(localhost)可以正常采集 放到线上服务器就自动跳转了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 include 'curl/curl_get.php';$url = 'http://www.expreview.com/39435.html';echo curl_get($url);<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>免费升级提前来袭:微软宣布夏季发布Windows 10正式版 - 超能网</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="keywords" content="超能网,expreview.com,评测,科技,硬件,显卡,智能手机,平板,主板,CPU,散热器,机箱,电源,游戏,高清,性能,测试" /><meta name="description" content="超能网(Expreview)专注于为主流科技产品提供全新视角的资讯,专注于100%高价值原创内容的创造,专注于最真实的体验式报道。" /><!-- Loading Style --> <link href="/exp_new/static/exp4/css/article_album.css" rel="stylesheet"/><link href="/exp_new/static/exp4/css/article_picture.css" rel="stylesheet"/> <link href="/data/cache/style_1_common.css" rel="stylesheet"/> <!-- Loading other --> <link href="/exp_new/static/exp4/css/bootstrap.css" rel="stylesheet"/> <link href="/exp_new/static/exp4/css/buttons.css" rel="stylesheet"/> <link href="/exp_new/static/exp4/css/font-awesome.css" rel="stylesheet"/>.......... curl_get.php这个是哪个? 这个文件我贴过好几遍了<?phpfunction curl_get($durl, $data=array()) { $cookiejar = realpath('cookie.txt'); $t = parse_url($durl); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$durl); curl_setopt($ch, CURLOPT_TIMEOUT,5);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_REFERER, "http://$t[host]/"); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_ENCODING, 1); //gzip 解码 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);if($data) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data);} $r = curl_exec($ch); curl_close($ch); return $r;} sorry 没看到 谢谢版主回答~ smarty 截取问题,请教,谢谢! MYSQL存储过程问题 正则拆分句子 网址改变,求救RewriteRule 正则表达式 DISCUZ更新缓存的过程 上传文件影响服务器网速吗? 分不多,有在中科软的吗? 【help!help!】如何实现检验两个密码框输入的一致? 如何简单有效的判断所在的URL是首页还是内页 pdo 插入中文就乱码,要疯了 PhalApi - 轻量级PHP后台接口开发框架 Apache配置,用location来限制某个方法的访问,但是同一个文件下的方法都有问题了
echo curl_get($url);<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>免费升级提前来袭:微软宣布夏季发布Windows 10正式版 - 超能网</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="keywords" content="超能网,expreview.com,评测,科技,硬件,显卡,智能手机,平板,主板,CPU,散热器,机箱,电源,游戏,高清,性能,测试" />
<meta name="description" content="超能网(Expreview)专注于为主流科技产品提供全新视角的资讯,专注于100%高价值原创内容的创造,专注于最真实的体验式报道。" />
<!-- Loading Style -->
<link href="/exp_new/static/exp4/css/article_album.css" rel="stylesheet"/><link href="/exp_new/static/exp4/css/article_picture.css" rel="stylesheet"/> <link href="/data/cache/style_1_common.css" rel="stylesheet"/>
<!-- Loading other -->
<link href="/exp_new/static/exp4/css/bootstrap.css" rel="stylesheet"/>
<link href="/exp_new/static/exp4/css/buttons.css" rel="stylesheet"/>
<link href="/exp_new/static/exp4/css/font-awesome.css" rel="stylesheet"/>
..........
function curl_get($durl, $data=array()) {
$cookiejar = realpath('cookie.txt');
$t = parse_url($durl);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$durl);
curl_setopt($ch, CURLOPT_TIMEOUT,5);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, "http://$t[host]/");
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_ENCODING, 1); //gzip 解码
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if($data) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
$r = curl_exec($ch);
curl_close($ch);
return $r;
}
sorry 没看到 谢谢版主回答~