1

I have following div,

<div class="info">
            Review Status: <span style="color:green;"><strong>Active</strong></span>
                        | Order #:
            <strong>
                22436            </strong>
            | Transaction Date:
            <strong><span class="mm_panel_text">
                                                    3/28/15                                                </span>
            </strong>

            <div class="separator-small"></div>

                <div class="separator-small"></div>
                <a href="/survey/flag/9287742"><i class="fa fa-flag"></i> Flag Review &raquo;</a>
                                     <a href="/user/contact/nintytwomw/comment/9287742"><i class="fa fa-envelope"></i> Email reviewer &raquo;</a>
                                                     <a  href="javascript:view_detail(8713492)"><i class="fa fa-search"></i> View details &raquo;</a>

                                    <a href="/survey/reply/9287742"> <i class="fa fa-bullhorn"></i> Post public reply &raquo;</a>
                                                     <a href="#" id="lnk_commentFeature_8713492" data-id="8713492" data-featured="no"><i class="fa fa-star"></i> Feature</a>
                                <!-- End Seller admin edit options -->

        <div class="separator"></div>

        <h3 class="subheader">Tag Review  <a href="#" data-reveal-id="user_terms"><i class="fa fa-question-circle"></i></a></h3>

        <ul class="tagdisplay taglist" survey_id="8713492" tags="[]"></ul>        <div class="separator"></div>


        </div>

Now I want to get access to class="mm_panel_text" and get content date.I wrote a code but it doesn't work.

foreach($html1->find('span[class="mm_panel_text"]') as $transaction_date){

    $transactionDate[] =  $transaction_date->innertext;



    //   $rating[] = $ratings->plainText;

    if (sizeof($transactionDate)==15) {

        var_dump($transactionDate);
    }

    //var_dump($links);
} 

There are many divs of this class. So I use loop to access all elemnts' content. What is the issue with the code? It doesn't display anything.

1 Answers1

1

This will simply do it

$transactionDate = $html1->find('span[class="mm_panel_text"]')->plaintext ;

Or

$transactionDate = $html1->find('span[class=mm_panel_text]')->plaintext ;

EDIT:

In case to loop over all div's having class mm_panel_text you can do this

foreach($html1->find('span.mm_panel_text') as $transaction_date)
Umair Ayub
  • 19,358
  • 14
  • 72
  • 146