How to parse text fragments located outside tags (inbetween tags) by simplehtmldom?

Posted by moogeek on Stack Overflow See other posts from Stack Overflow or by moogeek
Published on 2010-04-13T11:30:02Z Indexed on 2010/04/13 12:22 UTC
Read the original article Hit count: 387

Filed under:
|

Hello! I'm using simplehtmldom to parse html and I'm stuck in parsing plaintext located outside of any tag (but between two different tags):

<div class="text_small">
 <b>?dress:</b> 7 Hange Road<br>    
 <b>Phone:</b> 415641587484<br>    
 <b>Contact:</b> Alex<br>    
 <b>Meeting Time:</b> 12:00-13:00<br>
</div>

Is it possible to get these values of Adress, Phone, Contact, Meeting Time? I wonder if there is a opportunity to pass CSS Selectors into nextSibling/previousSibling functions...

foreach($html->find('div.text_small') as $div_descr) 
 {
   foreach($div_descr->find('b') as $b) 
 {
 if ($b->innertext=="?dress:") {//someaction
                }
 if ($b->innertext=="Phone:") { //someaction
                }
        if ($b->innertext=="Contact:") { //someaction
                }
        if ($b->innertext=="Meeting Time:") { //someaction
                }
    }
 }

What I should use instead "someaction" ?

upd. Yes, I don't have an access for editing the target page. Otherwise, would it be worth to? :)

© Stack Overflow or respective owner

Related posts about php

Related posts about parsing