Find div with class using PHP Simple HTML DOM Parser

前端 未结 3 1317
既然无缘
既然无缘 2020-12-15 01:54

I am just starting with the mentioned Parser and somehow running on problems directly with the beginning.

Referring to this tutorial:

http://net.tutsplus.com

3条回答
  •  渐次进展
    2020-12-15 02:24

    The to find the following elements: DIV -> class(product-inner clearfix) -> class(price) the following XPath can be used:

    foreach($html->find('div[class=product-inner  clearfix]') as $element){
            $itemPrice = $element->find('.price',0)->plaintext;
            echo $itemPrice;
        }
    

提交回复
热议问题