I have a website content, that I want to parse with Simple HTML DOM Parser, that is something like this:
...
<div id="page-content">
<div id="search-results-main" class="wide">
<table class="search-results">
<thead>...</thead>
<tbody>
<tr id="ad-123123">
<td class="thumbnail">...</td>
</tr>
...
</tbody>
</table>
</div>
</div>
...
This is my code right now:
include('./simple_html_dom.php');
$html = file_get_html('http://www.domain.com/subsite');
$searchResults = $html->find('table[@class=search-results');
foreach($searchResults->find('tr[@id^=ad-]') as $tr) {
...
}
The problem is that I get this error right now:
mod_fcgid: stderr: PHP Fatal error: Call to a member function find() on a non-object in /data/domains/mydomain/web/webroot/path/to/script.php on line 31
$html is not null, I already debugged it. I get the same result if I use this code for the table finding:
$searchResults = $html->find('.search-results');
What could be the problem?