Currently I am trying to parse all of the data from a page I won't link the page because I don't own it how ever it's only returning one result per album in my results.
Here's my code-
$download = $html2->find('ol.tracklist li.track',0);
$result['download-text'] = $link;
echo "<pre>";print_r($result);echo "</pre>";
The above code returns the following.
Array
(
[download-text] => Black Gold
)
Which is the title of the first track in the album, for the first result, I need it to return all of the results though, here's how the structure looks.
<li class="track" data-index="1" data-file="SOMELINK">Black Gold</li>
<li class="track" data-index="2" data-file="SOMELINK">Warrior / Sankofa (Ft. Camp Lo & Deion)</li>
<li class="track" data-index="3" data-file="SOMELINK">Trust Me (Ft. Sir)</li>
<li class="track" data-index="4" data-file="SOMELINK">Home (Ft. Damani Nkosi)</li>
<li class="track" data-index="5" data-file="SOMELINK">Almost There (Ft. Sir)</li>
<li class="track" data-index="6" data-file="SOMELINK">Live It Up (Ft. Iman Omari)</li>
<li class="track" data-index="7" data-file="SOMELINK">Fight On (Ft. Preston Harris & Damani Nkosi)</li>
<li class="track" data-index="8" data-file="SOMELINK">Spider's Jam (Ft. Georgia Anne Muldrow & Javonte)</li>
<li class="track" data-index="9" data-file="SOMELINK">Slip Away (Ft. Amaru)</li>
<li class="track" data-index="10" data-file="SOMELINK">Again (Ft. Fernando Pullum Creative Arts Center, Ryck Jane & Marcus Garvey Eleme)</li>
You can try like below:-
foreach($html2->find('ol.tracklist li.track') as $element){ // or use li.track only
echo "<pre/>";print_r($element->getAllAttributes());
}