Sunny Rty
Sunny Rty

Reputation: 11

Fetch Content from Div Class using PHP Simple HTML DOM Parser

div class="stars" span title="Money Locker :  Pulsa Gratis average
 rating 3.9" style="width:78%" span div


    $item['stars'] = $article->find('div.stars span', 0)->style;
                $item['stars'] = str_replace("width:", "", $item['stars']);

i want it span title= data only

i want this data "Money Locker : Pulsa Gratis average rating 3.9"

Upvotes: 0

Views: 140

Answers (1)

shushu304
shushu304

Reputation: 1498

try 2 things:

use the "title" property ... need to be exists like the "style" exists as an attribute of this span tag

$title = $article->find('div.stars span', 0)->title;

or you can use regex, and take the title content between the qutation mark

preg_match("/span title=\"(.+?)\"/", )

Upvotes: 1

Related Questions