bir HTML belgesi olarak aynı kimliğe sahip elemanların veri almak

0 Cevap php

Ben, HTML dosyasını ayrıştırmak için PHP DOMDocument sınıfını kullanarak ve kod kullanıyorum

$dom =new DOMDocument();
@$dom->loadHTMLFile($file_path);
$dom->getElementById("my_id")

to fetch the data of the element with the ID "my_id", but the problem is the HTML document is containing multiple elements with same ID, and i want the data in all that elements.. The HTML code,

<div id="my_id">
     phone number 123
</div>
<div id="my_id">
     address somewhere 
</div>
 <div id="my_id">
     date of birth
</div>

i know the ID is unique, but here the case is like that.. in this case will getElementById() will return an array..

0 Cevap