PHP抓取CNZZ相关网站的统计信息

WBOY
Release: 2016-06-23 13:55:39
Original
1634 people have browsed it

现今需要用PHP去获取公司的网站在CNZZ上的网站数据统计,但是不知道怎么去抓取数据。我尝试了curl 登录状态已经返回登录成功 然后就不知道下一步怎么做了 ,返回的是JSON格式的信息 {"data":{"status":"0","url":"http:\/\/new.cnzz.com\/v1\/main.php?s=site_list"}} 然后我要进入统计页面 就不知道怎么办了

下面是代码

header("content-Type: text/html; charset=utf-8");$username = "user";$password = "pw";$verifyCode = "";$remeber = "";$curlPost = 'username='.urlencode($username).'&passwd='.urlencode($password).'&verifyCode='.urlencode($verifyCode).'&remeber='.urlencode($remeber);$ch = curl_init();//初始化curlcurl_setopt($ch,CURLOPT_URL,'http://zhanzhang.cnzz.com/login.php');//抓取指定网页curl_setopt($ch, CURLOPT_HEADER, 0);//设置headercurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);//设置自动跳转curl_setopt($ch, CURLOPT_AUTOREFERER, 1); // 自动设置referercurl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);//要求结果为字符串且输出到屏幕上curl_setopt($ch, CURLOPT_POST, 1);//post提交方式curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);curl_exec($ch);//运行curl//curl_setopt($ch, CURLOPT_REFERER, 'http://new.cnzz.com/v1/main.php?s=site_list');curl_close($ch);
Copy after login


回复讨论(解决方案)

我最近也要做这个,不知道你的做完了没,能不能发给我一份呀393978119@qq.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template