I use simple dom parser to do some scrapping but failed to get the custom attribute (color). I was able to get others value like the h3's inner text.
My dom is simple it look like this
<article data-color="red">
<h1>Hi </h1>
</article>
<article data-color="blue">
<h1>Hi 2</h1>
</article>
<article data-color="gold">
<h1>Hi 3</h1>
</article>
My code so far
$dom = $html->find('article');
$arr = array();
foreach ($dom as $data) {
if(isset($data->find('h3',0)->plaintext)){
$h3 = $data->find(h3',0)->plaintext;
}
}
$arr[] = array(
"title" => $h3,
/* "color" => $color */
);
echo json_encode(array_values($arr));