Generate sitemap.xml

Hello, tell me how you can build a sitemap.xml to send a map to Google and Yandex, maybe there are sites that generate either scripts / programs.

Added.

I generate through a loop

$res = mysql_query("SELECT * FROM Subdivision WHERE Checked=1");  
$row = mysql_fetch_array($res);    
$fp = fopen( "sitemap.xml", "w" ) or die ( "   " );  
do {  
fputs( $fp, "<url>  
    <loc>http://site.ru/catalogview.php?id=$row[id]</loc>  
    <priority>1.0</priority>  
    <lastmod>2011-08-31T17:01:25+01:00</lastmod>  
</url>" );  
}while ($row = mysql_fetch_array($res));      
fclose( $fp );

The XML file is completely created, I send it to Google, it refutes it, what’s wrong?


Answer 1, authority 100%

The file should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
#     #
</urlset>

and everything will be fine.


Answer 2

I generated manually based on their docks, there is nothing complicated there – just pass the necessary data and form xml from them.


Answer 3

If there is a list of URLs, web server folders or web server logs on the basis of which you need to create your sitemap.xml, then Google Sitemap Generator. There are also sites that crawl the site and give out sitemap.xml based on the results, for example, xml-sitemaps.com.