I am going thru some elements on site and cannot get value of email.
I`ve tried with different selectors.
$data5 = $html->find('div[class="OglasContactDataRight"]',4)->plaintext;
var_dump($data5);
echo "5:";
echo $data5;
element source from where I am getting this data is:
<div class="OglasContactDataRight"><a href="mailto:[email protected]" class="sup">[email protected]</a></div>
I would like to get plaintext value of a email.
You could make the selector a bit more specific using div[class="OglasContactDataRight"] a.sup
and then pass 0 to find to get the 0 anchor.
$data5 = $html->find('div[class="OglasContactDataRight"] a.sup', 0);
echo $data5->plaintext; // [email protected]
Or if you have multiple you could use a foreach
:
$html->find('div[class="OglasContactDataRight"] a.sup');
foreach ($html->find('div[class="OglasContactDataRight"] a.sup') as $item) {
echo($item->plaintext);
}