请问哪位达人能采集PHPWIND7需登陆的内容?
论坛里的视频方法不管用的。服务端似乎验证了lastpost的cookie。在网上找了个curl登录也登录不上~~$ch = curl_init();
$data = array(
'pwuser' =>'lolfreeman' ,
'pwpwd' => 'aaaaaa',
'cktime' => '31536000');
curl_setopt($ch, CURLOPT_COOKIEJAR, "D:/web/bbs/cookies.txt");
curl_setopt($ch, CURLOPT_URL,"http://www.phpwind.net/login.php?");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
ob_start(); // prevent any output
curl_exec ($ch); // execute the curl command
ob_end_clean(); // stop preventing output
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "D:/web/bbs/cookies.txt");
curl_setopt($ch, CURLOPT_URL,"http://www.phpwind.net/index.php");
$buf2 = curl_exec ($ch);
curl_close ($ch);
echo $buf2;达人帮忙分析下吧,谢谢! 给个地址偶看看 3# chyy
http://www.phpwind.net/thread-htm-fid-76.html
这里要求积分大于1的会员可以访问 不好意思,偶没有权限 测试了其他需登陆的 可以采 5# chyy
那就这里吧
http://www.phpwind.net/search.php
用户名:lolfreeman 密码aaaaaa
反正就是要登录才能访问的页面采集不到 不用试了 可以采集的 我去整个phpwind7的回复模块提高级别 谢谢楼上的。用正常方法我还是采集不了。不过配合Curl倒是可以了。有同要问题的可以试试
附上代码:
$site="http://www.xxx.com";//要采集的站
$NNDzhongyukeyile = $_GET;
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "D:/web/bbs/cookies.txt"); //cookies保存文件
curl_setopt($ch, CURLOPT_URL,"http://$site/login.php?"); //登录form
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "forward=&jumpurl=http%3A%2F%2F$site%2F&step=2&lgt=0&pwuser=用户名&pwpwd=密码&question=0&customquest=&answer=&hideid=0&cktime=31536000"); //登录发送的数据包
ob_start();
curl_exec ($ch);
ob_end_clean();
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "D:/web/bbs/cookies.txt"); //读取cookies保存文件
curl_setopt($ch, CURLOPT_URL,"http://$site/xxx.php?id=$NNDzhongyukeyile");//最终采集页面。$NNDzhongyukeyile是变量
$buf2 = curl_exec ($ch);
curl_close ($ch);
echo $buf2;
把以上代码保存为x.php 。放到支持curl的空间,在火车头采集http://你的域名/x.php?id=变量
就行了 谢谢分享撒"!
页:
[1]
2