I have a site that I need to parse with Simple HTML DOM Parser that is something like this:
…
<table class=”search-results”>
<thead>…</thead>
<tbody>
<tr id=”ad-123123″>
<td class=”thumbnail”>…</td>
</tr>
…
</tbody>
</table>
…
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 difficult is that I catch 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? Is there any person who can guide me in it!