Skip to content
Advertisement

Goutte laravel web scrap from all table data

I need to scrap all Th and td data return like an array. Result showing only first Th/td data.

JavaScript

result showing only first Th/td, need to all row:

JavaScript

Advertisement

Answer

The provided code is looping every table ($page->filter('table')->each) and selecting only a single tr > th. But what you want is to loop the tr‘s of the table.

Probably you will need to do something like the following:

JavaScript

Have not tested this myself.

Tip: Take a look at the source of the page and try to make the selectors.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement