我想从YMCA本地调度中提取数据,包含数据的表在div="scheduler_here"下。对于这个项目,我使用的是PHP Simple HTML DOM Parser。但它没有显示任何数据。
<?php
// Include the library
include('simple_html_dom.php');
// Retrieve the DOM from a given URL
$html = file_get_html('http://www.activelifeadmin.com/newyork/websearch/public/index/weekview?sched=Group%20Exercise%20Schedule,Large%20Pool,Small%20Pool&branch_ids=38#/');
// Find the DIV tag with an id of "myId"
foreach($html->find('div[scheduler_here]') as $e)
echo $e->innertext . '<br>';
?>
输出PHP
基督教青年会网站
您需要通过id属性获取:
foreach($html->find('div[id=scheduler_here]') as $e)