I have the list of tags in php and I want to get the contents.

for example:

<li class="zc-ssl-pg" id="row0-1" style="">
    <span id="row1Time" class="zc-ssl-pg-time">6:00 PM</span>
    <a id="rowTitle1" class="zc-ssl-pg-title" href='http://www.mysite.com'>Melissa & Joey</a>
    <a class="zc-ssl-pg-ep" href='http://www.mysite.com'>"House Broken"</a>

    <li class="zc-ssl-pg" id="row1-1" style="">
    <span id="row1Time" class="zc-ssl-pg-time">6:00 PM</span>
    <a id="rowTitle1" class="zc-ssl-pg-title" href='http://www.mysite.com'>The Middle</a>
    <a class="zc-ssl-pg-ep" href='http://www.mysite.com'>"Thanksgiving IV"</a>

Here's the PHP:

<?php

      $links = "WEBSITE URL";
      $result = file_get_contents($links);
      $dom = new DOMDocument();
      $dom->loadHTML($result);
      echo $dom->getElementById('row1Time')->nodeValue . "<br>";
    ?>

When I use the code as above, it will only get the contents from the tags with array value 0.

I want to get the tags `row1Time, rowTitle1 and zc-ssl-pg-ep with the array 1 value.

Can you please tell me how I can get the contents from the class tags with the array value 1 using with DOMDocument?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.