0

I am trying to parse this HTML

<div id="id1">
  <div id="subclass"> TEXT1 </div>
</div>

<div id="id2">
  <div class="subclass"> TEXT2 </div>
</div>

<div class="class1 ">
  <div class="subclass"> TEXT3 </div>
</div>

this is view page. I want to search id1 to class1(that div id="id1" to div class="class1" to find). I am Trying like this

foreach($html->find('div#subclass-single>div.class1 a') as $e){
    echo $e->href . '<br>';
}
3
  • possible duplicate of PHP Simple HTML DOM Parser: Select only DIVs with multiple classes Commented May 20, 2015 at 6:09
  • I need between two div class or id. you say two different class.... Commented May 20, 2015 at 6:11
  • @Karthick Kumar If all divs are on the same level go to next by next_sibling () untill <div class="class1 "> Commented May 20, 2015 at 8:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.