Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#135 Fails on complex tables

v1.0_(example)
open
John Schlick
None
9
2014-03-24
2013-08-27
Praz
No

This is failing to iterate some tables. An example url would be http://www.imdb.com/name/nm0000115/awards

:::php
function get_award_list($imdb_person_id) {
$html = file_get_html('http://www.imdb.com/name/nm0000115/awards');
if(!$html) { return; }

$tables = $html->find('table');
if(sizeOf($tables) == 2) {
    $this->logs[] = "No awards found";
    return;
}

foreach($html->find('table', 0)->find('tr') as $tr) {
    echo "<pre>";
    var_dump($tr);
    echo "</pre>";
}

}

With the above code, the 27th "tr"(Favorite Actor - Suspense for: Snake Eyes (1998).) is ignored completely. This looks like a bug.

Thanks.

Discussion

  • Praz
    Praz
    2013-08-27

    :::php
    function get_award_list() {
    $html = file_get_html('http://www.imdb.com/name/nm0000115/awards');
    if(!$html) { return; }

    $tables = $html->find('table');
    if(sizeOf($tables) == 2) {
        $this->logs[] = "No awards found";
        return;
    }
    
    foreach($html->find('table', 0)->find('tr') as $tr) {
        echo "<pre>";
        var_dump($tr);
        echo "</pre>";
    }
    

    }

     
  • Praz
    Praz
    2013-08-27

    Sorry but I couldn't format the code well.