This is HTML page (test.html)
<div id = 'mainid'>
<div id = 'subid'>
Name: ABC
</div>
<div id = 'subid'>
Country: USA
</div>
<div id = 'subid'>
Date of birth: 15 Feb 1985
</div>
</div>
<div id = 'mainid'>
<div id = 'subid'>
Name: Jisan
</div>
<div id = 'subid'>
Country: Japan
</div>
<div id = 'subid'>
Date of birth: 15 Feb 1985
</div>
</div>
<div id = 'mainid'>
<div id = 'subid'>
Name: Mr Barman
</div>
<div id = 'subid'>
Country: Canada
</div>
<div id = 'subid'>
Date of birth: 15 Feb 1985
</div>
</div>
The PHP Code here
$file = $DOCUMENT_ROOT. "test.html";
$doc = new DOMDocument();
$doc->loadHTMLFile($file);
$xpath = new DOMXpath($doc);
$Querys = $xpath->query("*//div[@id='mainid']");
foreach ($Querys as $Querys) {
echo $Name = Please help me about this code;
echo $Country = Please help me about this code;
echo $DOB = Please help me about this code;
}
NOTE: i want to get result like this
Name: ABC, Country: USA, Date of birth: 15 Feb 1985.
Name: Jisan, Country: Japan, Date of birth: 15 Feb 1985.
Name: Mr Barman, Country: Canada, Date of birth: 15 Feb 1985.