<?php
header("Content-Type: application/xml; charset=utf-8");

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">

<?php
$root = $_SERVER['DOCUMENT_ROOT'];

$iterator = new RecursiveIteratorIterator(
    new RecursiveDirectoryIterator($root)
);

foreach($iterator as $file){

    if($file->isDir()) continue;

    $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));

    if(in_array($ext,['php','html'])){

        $path = str_replace($root,'',$file->getPathname());
        $url = "https://sgspm.com".str_replace("\\","/",$path);

        echo "<url>\n";
        echo "<loc>".htmlspecialchars($url)."</loc>\n";
        echo "</url>\n";
    }
}
?>

</urlset>