I'm trying to fetch data from html document.
<table style="border:0px none;margin:0px;padding:0px"><tr><td valign="middle"><p style="background-color:#EE0000;color:#fff;margin-right:5px;padding: 2px 3px;"><b>7767</b></p></td><td valign="middle"><h2 style="padding:1px">title 2</h2></td></tr></table>
there are undeterminated number of tables in the page like this one , every time when there are a table I want to get the number after the style, here 7767 , and the sentence in the second , here title 2. I found some examples I tried to adjust them but it still don't work
$html = file_get_html('http://website.com/');
foreach($html->find('table') as $article) {
$item['nummer'] = $article->find('td.b', 0)->plaintext;
$item['title'] = $article->find('td.h2', 0)->plaintext;
$articles[] = $item;
}
td.bmeans aTDtag withclass="b", andtd.h2means aTDtag withclass="h2". Why are you specifying classes in your selectors when your data doesn't have those classes?