为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用CURL采集CNZZ数据

如果通过CURL模拟登录CNZZ然后采集数据

$cookie_file = tempnam('./wei1','wei');

$login_url  = 'http://i.qq.com/';

$post_fields ='http://web.umeng.com/main.php?c=user&a=login';

$ch = curl_init($login_url);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);

curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);

$arr=curl_exec($ch);

curl_close($ch);



$url='https://web.umeng.com/main.php?siteid=1256657021&c=flow&a=trend&ajax=module=flash&st=2016-08-09&et=2016-08-09&type=Line&Period=Hour&Quota=pv&_=1470735753213';

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);

$contents = curl_exec($ch);

echo $contents;

curl_close($ch);

这样写有什么不对吗,都登录不上CNZZ, 是怎么喇

正在回答

1 回答

最后两句调换位置

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

如何使用CURL采集CNZZ数据

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号