php - 网络爬虫脚本不适用于日历事件

标签 php web-crawler

我写了一个网络爬虫脚本 代码是::

<?php
include_once('simple_html_dom.php');
$target_url = "http://jvlaunchcalendar.com/calendar/";
$html = new simple_html_dom();
$html->load_file($target_url);
$ret = $html->find('div[class=fc-event-inner'); 
//to print the caleder events similar code //works for other sites like flipcat.com
foreach($ret as $post)
{
    echo $post.'<br />';
}
echo $html;// to print the calender of jvlaunchcalendar.com site
?>

此脚本适用于其他网站。 但我想要 http://jvlaunchcalendar.com/calendar/ 的所有日历事件页面但此脚本不显示任何事件给出空日历。 请帮我获取日历的事件。

问候。

最佳答案

当您尝试 $html->load_file($target_url); 时,您会得到没有任何事件的空页面,因为事件是使用 ajax 加载的。

获取事件的简单解决方案:跟踪 ajax url 调用并加载它,而不是页面。 (我检查了,它返回json数据,一切正常)。

但这并不好。其他方式 - 在 WordPress 中使用 native 日历功能进行操作。

关于php - 网络爬虫脚本不适用于日历事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13874277/

相关文章:

web-scraping - 是否存在任何开放的、可简单扩展的网络爬虫?

php - 使用 PHP 将 XML 转换为 HTML 表格

php - 如何连接两个表并返回两个表中的所有行

php - 在 MySQL(消息系统)中返回多个收件人姓名

php - 找不到类

java - 将 URL 限制为仅种子 URL 域crawler4j

c# - mysql和mssql之间来回发送数据

java - 是否可以通过Crawler4j检索网站内容?

android - 正在运行 Android Marketplace Crawler ('hg' 目录?)

python - 摆脱重复链接的麻烦