I’am trying to build a scraper using simple-html-dom.
Each tr has the class "event-listing" as well as a unique id. Everything is working but I cannot figure out how to get and store the id’s.
Here’s my code:
foreach($html->find('tr[class=event-listing]') as $event)
{
$item['date'] = trim($event->find('td', 0)->plaintext);
$first_trim = ltrim($event->find('td', 1)->plaintext, 'at ,vs.');
$item['opponent'] = rtrim($first_trim, ' * ');
$item['location'] = trim($event->find('td', 2)->plaintext);
$item['time'] = trim($event->find('td', 3)->plaintext);
$sched[] = $item;
}
You don’t need anything special
$event->idwould work just fineOutput