我想从其他网站页面上抓取数据,这些页面动态加载表格的数据。我正在使用Php和简单的Html Dom进行抓取,搜索后没有找到任何解决方案,如何从网页中抓取动态数据?或者有另一种方法可以做到这一点?
我必须从这个url->https://fantasy.premierleague.com/a/leagues/standings/313/classic中抓取表数据。
我使用下面的代码来做这件事。
$url = "https://fantasy.premierleague.com/a/leagues/standings/313/classic";
$html = file_get_html($url);
$html->find('div#ismr-classic-standings');
foreach($html->find('table.ism-table--standings tr') as $row){
//But count($row)=0 due to late loading html in table.
}发布于 2017-03-30 21:50:16
您的页面正在调用另一个链接并检索JSON数据;请尝试以下代码:
include "simple_html_dom.php";
$MyWebsite = 'https://fantasy.premierleague.com/drf/leagues-classic-standings/313?phase=1&le-page=1&ls-page=1';
$html = file_get_html($MyWebsite);
$JSON_value = json_decode($html, true);
$results = $JSON_value['standings']['results'];
foreach($results as $result) {
echo $result['entry_name'] . '->' . $result['event_total'] . '<br/>';
}https://stackoverflow.com/questions/39093305
复制相似问题