Código PHP:
<?
header("Content-Type: text/xml; charset=UTF-8");
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?
//Conexion Base de Datos
mysql_connect('xxxx','xx','xxx');
mysql_select_db('xxx');
function limpiar_caracteres_especiales($s) {
$s = ereg_replace("[áÃ*âãª]","a",$s);
$s = ereg_replace("[ÃÀÂÃ]","A",$s);
$s = ereg_replace("[éèê]","e",$s);
$s = ereg_replace("[ÉÈÊ]","E",$s);
$s = ereg_replace("[Ã*ìî]","i",$s);
$s = ereg_replace("[ÃÌÎ]","I",$s);
$s = ereg_replace("[óòôõº]","o",$s);
$s = ereg_replace("[ÓÒÔÕ]","O",$s);
$s = ereg_replace("[úùû]","u",$s);
$s = ereg_replace("[ÚÙÛ]","U",$s);
$s = str_replace(" ","-",$s);
$s = str_replace("ñ","n",$s);
$s = str_replace("Ñ","N",$s);
$s = str_replace("ñ","n",$s);
$s = str_replace(":"," ",$s);
//para ampliar los caracteres a reemplazar agregar lineas de este tipo:
//$s = str_replace("caracter-que-queremos-cambiar","caracter-por-el-cual-lo-vamos-a-cambiar",$s);
return $s;
}
$result = mysql_query ("SELECT * FROM peliculas ORDER BY id DESC");
while ($row = mysql_fetch_array($result))
{
$lastmod = date ("Y-m-d");
$tituloo=$row['Titulo'];
$titulooo=limpiar_caracteres_especiales($tituloo);
$url = 'http://www.mira-divx.com/id/'.$row['id'].'/ver-online/'.$titulooo.'/';
?>
<url>
<loc><? echo $url; ?></loc>
<lastmod><? echo $lastmod ?></lastmod>
<changefreq>daily</changefreq>
<priority>0.50</priority>
</url>
<?
}
?>
</urlset>