I am using SIMPLE HTML DOM to scrape a website and I'm getting the following code...
$GameSummary
<dl class="ismSummary ismHomeSummary">
<dt>Goals scored</dt>
<dd><a class="ismViewProfile" href="#438">Gallas</a></dd>
<dd><a class="ismViewProfile" href="#458">Defoe</a></dd>
<dt>Assists</dt>
<dd><a class="ismViewProfile" href="#443">Vertonghen</a></dd>
<dd><a class="ismViewProfile" href="#447">Lennon</a></dd>
<dt>Yellow cards</dt>
<dd><a class="ismViewProfile" href="#438">Gallas</a></dd>
<dd><a class="ismViewProfile" href="#439">Walker</a></dd>
<dd><a class="ismViewProfile" href="#450">Huddlestone</a></dd>
<dt>Saves</dt>
<dd><a class="ismViewProfile" href="#433">Friedel</a> (3)</dd>
</dl>
I am trying to cut each section to its specific sections... I am trying to get the following info in the following order...
Heading1: Goals Scored
Entry: Gallas
Entry: Defoe
Heading2: Assists
Entry: Vertongen
Entry: Lennon
etc....
Here's the code I can get the headers with...
foreach ($GameSummary->find('dt') as $HeadingType)
{
echo $HeadingType;
}
Gives me all headings... and to get content of each header..
foreach ($GameSummary->find('dd') as $PlayerNames)
{
echo $PlayerNames;
}
What I am wondering is... How do I separate these into different groups? I can get all the headers and all the content separately, but I don't know how to get it so that each header contains its contents.
Any ideas how? It should be easy enough but my brain can't figure it out.
Thanks!
EXAMPLE AT: http://fantasypl.com/results.php