PHP DOM Cannot print each <td> elements from table`s column in an array

I am scraping some table content elements from this web page:

Here is a screenshot of the table: VEHICLE FITMENT from which I want to get content:

enter image description here

I want to print each column data- for example those in ,Brand and model", ,Type", etc. in a new array so then I can put them in a csv file. Here is my code so far:

            $description = $html->find("iframe[id=desc_ifr]", 0);
            //var_dump($description);
            if($description != null){
                $source = $description->src;

                if(isset($source)){
                    $descrHtml = getWebPage($source);
                    unset($source);
                    $descrDom = new simple_html_dom();
                    $descrDom->load($descrHtml);

                    foreach ($descrDom->find(".tbl-fit") as $key => $td) { 
                    $descr=$td->plaintext ."\n";
                    var_dump($descr);   
                    }
                }
            }

I’m probably remembering it wrong but I seem to remember PHPs dom objects to be so overflowing with data that someone made the decision to make it impossible to print_r or var_dump them.

I always wound up having to use some other library for this kind of task like symfony dom crawler or querypath

It is right however my task is to use the DOM library

Sponsor our Newsletter | Privacy Policy | Terms of Service