How can I get all the rows with a specific class name such as:
<tr class="dailyeventtext" bgcolor="#cfcfcf" valign="top">
and then place each cell in that row into an array?
I used cURL to get the page off the client's server.
How can I get all the rows with a specific class name such as:
<tr class="dailyeventtext" bgcolor="#cfcfcf" valign="top">
and then place each cell in that row into an array?
I used cURL to get the page off the client's server.
$matches = array();
$dom = new DOMDocument;
$dom->loadHTML($html);
foreach($dom->getElementsByTagName('tr') as $tr) {
if ( ! $tr->hasAttribute('class')) {
continue;
}
$class = explode(' ', $tr->getAttribute('class'));
if (in_array('dailyeventtext', $class)) {
$matches[] = $tr->getElementsByTagName('td');
}
}