i am trying to get the 'tel' attribute of but cant get it.
<div class="horizontal-center" ng-class="classActive()" ng-click="clicked($event)" id="7076213" account-id="536423" user-id="651772" event-label="listing-detail" event-action="phone-number-viewed-in-sideways" tel="8503128272" action-type="DetailPhone">
i was trying with these codes. 1.
foreach ($html1->find('div.horizontal-center') as $phone) {
echo $ilanlar['phone'] = $phone->{'tel'};
}
2.
foreach ($html1->find('div.horizontal-center') as $phone) {
echo $ilanlar['phone'] = $phone->getattribute('tel');
}
include('simple_html_dom.php');
$html1 = str_get_html('<div class="horizontal-center" ng-class="classActive()" ng-click="clicked($event)" id="7076213" account-id="536423" user-id="651772" event-label="listing-detail" event-action="phone-number-viewed-in-sideways" tel="8503128272" action-type="DetailPhone">');
foreach ($html1->find('div.horizontal-center') as $phone) {
echo $ilanlar['phone'] = $phone->{'tel'};
}
echo '<br>';
foreach ($html1->find('div.horizontal-center') as $phone) {
echo $ilanlar['phone'] = $phone->getattribute('tel');
}
Works fine for me. Output is:
8503128272<br>8503128272