问:数据采集有关问题-内容由AJAX动态加载

WBOY
Release: 2016-06-13 13:39:56
Original
787 people have browsed it

问:数据采集问题-内容由AJAX动态加载
最近一直在看PHP数据采集的知识,却在采集一些网站内容时遇到了一个大困难,例如在当当网的周排行榜:bang.dangdang.com/book/bestSeller/ 页面,这些列表数据也是AJAX获取的,不能直接获取源代码进行分析,我追踪它内容的获取是由以下的的AJAX代码加载的:

  //动态调用右侧内容
$.ajax({
url: "contentList.php?catpath="+ strCatPath + "&type=" + strType + "&year=" + strYear + "&month=" + strMonth + "&range=" + strRange,
cache: false,
type: "POST",
data: "catTitleName="+catTitleName+"&catTitleOther="+catTitleOther,
success: function(html){
$("#divContentDateList").css("display","none");
$("#divContentDateList").html(html);
$("#divContentDateList").fadeIn("slow");
}
});

这里可以看到,这些列表内容来自contentList.php,传回的内容在html变量里面,请问下一步该怎么办,我在本地也写一个请求contentList.php的AJAX文件吗,还是获取到html的值再进行数据采集

就是说,对这种AJAX动态加载的页面,数据采集方法:
1、自己写一个JS,请求它的服务器脚本,获取返回内容
2、获取它已经返回的内容

在实际操作中,是哪一种在应用呢,怎样获取呢,请求大哥哥大姐姐教教小弟,不胜感激

------解决方案--------------------
你要自己写contentList.php取采集内容
可以用cURL加正则表达式实现
------解决方案--------------------
源程序应该是用AJAX获取用户信息,同时传输到contentList.php做下一步处理,任何信息都要进行一些处理的吧。处理结果又返回来给页面,页面才做出响应。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!