0

I have this piece of HTML code :

                <div class='ipsDataItem_main'>
                    <h4 class='ipsDataItem_title ipsContained_container'>
                                <span>
                                    <a href='https://www.' title='Aller au premier message non lu' data-ipsTooltip>
                                        <span class='ipsItemStatus'><i class="fa fa-circle"></i></span>
                                    </a>
                                </span>
                        <span class='ipsType_break ipsContained'>
                            <a href='https://www../topic/81272-une-a' class='' title='Une affaire de '  data-ipsHover data-ipsHover-target='https://www/?preview=1' data-ipsHover-timeout='1.5'>
                                <span>
                                    Une affa.    
                                </span>
                            </a>
                        </span>
                    </h4>
                    <div class='ipsDataItem_meta ipsType_reset ipsType_light ipsType_blendLinks'>
                        <span>
                            Par 
<a href='https://www../profile/5825-crobler/' data-ipsHover data-ipsHover-target='https://www../profile/5825-cr' title="Aller sur le profil " class="ipsType_break"><span style='color:#0099cc'>Crobler</span></a>,
                        </span><time datetime='2021-03-05T1:5:09Z' title='05/01/2021 20:59 ' data-short='2 j'>Vendredi à 20:59</time>
                        dans <a href="https://www../?fo">WEB-DL 2160</a>
                            &nbsp;&nbsp;
        <ul class='ipsTags ipsTags_inline ipsList_inline '>
<li >
    <a href="https://www../tags/une_ails/" class='ipsTag' title="" rel="tag"><span></span></a>
    
</li>
    </ul>   
                    </div>
                </div>

I would like to extract title of time tag "05/01/2021 20:59". I tried this following code :

foreach($html->find('div[class=ipsDataItem_main] a') as $f) {
     
   echo $f->title;
   
}

I have as results all titles but not the one I want. How i can do this please ? And how i can choose only the "title" i want ? For example title in "ipsType_break ipsContained" class ?

Thank you in advance.

1
  • 1
    Does $html->find('.ipsDataItem_meta time') give the right item? Commented Mar 8, 2021 at 18:33

2 Answers 2

2
foreach($html->find('.ipsContained a') as $element) {
       echo $element->title ; 
}
Sign up to request clarification or add additional context in comments.

Comments

0

It's just a case of getting the right path to find the data you are after...

$html->find('.ipsDataItem_meta time')

Comments

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.