Tags
Asked 3 years ago
30 Jun 2021
Views 459
Jesus

Jesus posted

Parse XML file with PHP

Parse XML file with PHP
Cimb

Cimb
answered Jul 1 '21 00:00

use XMLReader , as per below code :

$reader = new XMLReader();
$reader->open('sitemap.xml');
$count=0;
while ($reader->read()) {
 if($reader->name=='url'){ 
 	$count++; 
 }
}
echo $count;

above code is read sitemap.xml and give count of the url elements
Post Answer