Web爬网程序脚本不适用于日历事件

时间:2012-12-14 07:14:17

标签: 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/页面的所有日历事件,但此脚本不显示任何事件给出空日历。 请帮我看一下日历事件。

问候。

1 个答案:

答案 0 :(得分:3)

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

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

但这并不好。其他方式 - 使用本机日历功能在WordPress中完成。