1
I have the following code to generate sitemap:
<?php
header("Content-type: text/xml");
echo'<?xml version=\'1.0\' encoding=\'UTF-8\'?>';
echo' <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
include 'conexao.php';
$sql = mysql_query("select aluno, matricula, aprovacao from faculdade");
while ($string = mysql_fetch_array($sql)){?>
<?php
$dataaprovacao = $string['aprovacao'];
$newDate = date("Y-m-d", strtotime($dataaprovacao));
?>
<url>
<loc>https://site.com.br/<?echo $string['aluno'];?>/<?echo $string['matricula'];?></loc>
<lastmod><?echo $newDate;?></lastmod>
</url>
<?php } ?>
</urlset>
I would like to save this answer in several files (sitemap1.xml, sitemap2.xml etc.) with 50,000 urls each. It is possible?
It is possible yes. You can use the functions
fwrite
orfile_put_contents
to save the data to a file.– Valdeir Psr