<?php

header("Content-Type: application/xml; charset=utf-8");

echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

function scanDirRecursive($dir) {

    $files = scandir($dir);

    foreach($files as $file) {

        if($file == '.' || $file == '..') continue;

        $path = $dir . '/' . $file;

        if(is_dir($path)) {

            scanDirRecursive($path);

        } else {

            if(pathinfo($path, PATHINFO_EXTENSION) == 'php') {

                $url = str_replace($_SERVER['DOCUMENT_ROOT'], '', $path);

                echo '<url>';
                echo '<loc>https://www.touslestheatres.com' . $url . '</loc>';
                echo '<changefreq>weekly</changefreq>';
                echo '<priority>0.7</priority>';
                echo '</url>';
            }
        }
    }
}

scanDirRecursive($_SERVER['DOCUMENT_ROOT']);

echo '</urlset>';

?>