I have an HTML file with tracks in a list. I want to create an PHP Object for each track and save all objects into a PHP-Array.

**HTML DOM in my test.html file:**

```
<ul>
    <li class="track">
        <span id="primary-info">
            <span class="interpret">Lorem ipsum</span>
            <span class="title">dolor sit amet</span>
        </span>
        <span class="secondary-info">
            <span class="playtime">6:00</span>
            <span class="label">consetetur</span>
        </span>
    </li>

    <li class="track">
        <span id="primary-info">
            <span class="interpret">sed diam</span>
            <span class="title">nonumy eirmod</span>
        </span>
        <span class="secondary-info">
            <span class="playtime">7:00</span>
            <span class="label">invidunt</span>
        </span>
    </li>

</ul>

```

**My PHP Code:**

```
    <?php

    $lTracklistArr = [];

    // get the html
    $HTML = file_get_contents("http://localhost/test.html");

    // load the dom
    $lDoc = new DOMDocument();
    $lDoc->loadHTML($HTML);

    // create XPath obj
    $XPath = new DOMXPath($lDoc);

    // get all tracks
    $lTracks = $XPath->query("//*[@class='track']");

    $i = 0;
    while($lTracks->item($i))
    {
        // How can I get the values from the sub-elements from the DOM?
        $lInterpret = $lTracks->item($i)-> ?
        $lTitle = $lTracks->item($i)-> ?
        $lPlaytime = $lTracks->item($i)-> ?
        $lLabel = $lTracks->item($i)-> ?

        $lTracklistArr[] = new Track($lInterpret, $lTitle, $lPlaytime, $lLabel);

        $i++; 
    }

    // show tracklist
    print_r($lTracklistArr);

    // PHP class about one track
    Class Track
    {
        var $m_Interpret;
        var $m_Title;
        var $m_Playtime;
        var $m_Label;

        public function __construct($pInterpret, $pTitle, $pPlaytime, $pLabel) 
        {
            $m_Interpret = $pInterpret;
            $m_Title = $pTitle;
            $m_Playtime = $pPlaytime;
            $m_Label = $pLabel;
        }
    }
?>

```

It is no problem to get the tracks. But I cannot get the values from the sub-elements by class name.

**NOTE: the order of the DOM in a track can change. It is necessary to get the elements by the class name.**