1

I am trying to extract the table data from https://ownerschoicebuffalo.mortgagewebcenter.com/

I am using simplehtmldom.php

My code is as follows:

<?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;
        }
    }
}
?>

I've tested this on other sites just using:

$table=$html->find('table');
foreach($table as $e)
{
    echo $e->innertext;
}

And it's worked. Could there just be something about this specific site that I am missing?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • done any basic debugging, like `file_get_contents()` instead and `var_dump` the returned string? You're just assuming that fetching from the url can never fail, or that the site doesn't have anti-scraping protection. – Marc B May 26 '15 at 16:40
  • you can refer this link, May be helpful http://stackoverflow.com/questions/14962359/how-to-use-file-get-contents-or-file-get-html. – Ashwani May 26 '15 at 16:44
  • @MarcB I have tried var_dump. I've been able to get other classes and content out of the site, just not the table I need. – MindYaBidness May 26 '15 at 17:16

0 Answers0