Php 为什么可以';我是否使用simpleHTMLDOM提取表数据?

Php 为什么可以';我是否使用simpleHTMLDOM提取表数据?,php,web-scraping,extract,Php,Web Scraping,Extract,我正在尝试从中提取表数据 我正在使用simplehtmldom.php 我的代码如下: <?php include('simple_html_dom.php'); $html = file_get_html('https://ownerschoicebuffalo.mortgagewebcenter.com/'); foreach($html->find('table') as $table) { foreach($table->find('tr') as $tr)

我正在尝试从中提取表数据

我正在使用simplehtmldom.php

我的代码如下:

<?php
include('simple_html_dom.php');
$html = file_get_html('https://ownerschoicebuffalo.mortgagewebcenter.com/');

foreach($html->find('table') as $table)
{
    foreach($table->find('tr') as $tr)
    {
        foreach($tr->find('td') as $td)
        {
            echo $td->innertext;
        }
    }
}
?>

而且成功了。这个特定的站点是否有我遗漏的地方?

完成了一些基本的调试,比如
file\u get\u contents()
var\u dump
返回的字符串?您只是假设从url获取永远不会失败,或者站点没有防刮保护。您可以参考此链接,可能会有所帮助。@MarcB我尝试过var_dump。我已经能够从网站上获得其他课程和内容,只是没有我需要的表格。
$table=$html->find('table');
foreach($table as $e)
{
    echo $e->innertext;
}