codice:
	function purifica($stringa){
	$stringa=str_replace('à', 'a', $stringa);
	$stringa=str_replace('è', 'e', $stringa);
	$stringa=str_replace('ì', 'i', $stringa);
	$stringa=str_replace('ò', 'o', $stringa);
	$stringa=str_replace('ù', 'u', $stringa);
	$stringa=str_replace('&', '', $stringa);
	$stringa=str_replace('.', '', $stringa);
	
	return $stringa;	
}#purifica
  // CONNECT TO DATABASE
  mysql_select_db($database, $cnConnection);
  
  $query_rsRecordset = "SELECT annunci.idAnnuncio,annunci.citta,annunci.codice_cap,annunci.provincia,annunci.regione,annunci.indirizzo,annunci.data_annuncio,annunci.tipo_contratto,annunci.titolo,annunci.tipologia,annunci.descrizione,annunci.tipo_contratto,annunci.metri_quadri,annunci.prezzo,annunci.immagine,annunci.immagine2,annunci.immagine3,annunci.immagine4,annunci.immagine5,annunci.immagine6,annunci.immagine7,annunci.immagine8,agenzie.nome AS nomeAgenzia,agenzie.telefono AS fissoAgenzia,agenzie.cellulare AS cellAgenzia,agenzie.email AS emailAgenzia FROM annunci,agenzia_annuncio,agenzie WHERE annunci.attivo='SI' AND annunci.idAnnuncio=agenzia_annuncio.idAnnuncio AND agenzia_annuncio.idAgenzia=agenzie.idAgenzia ORDER BY (annunci.idAnnuncio) DESC";# LIMIT 0,3
  $rsRecordset = mysql_query($query_rsRecordset, $cnConnection) or die(mysql_error());
  $row_rsRecordset = mysql_fetch_assoc($rsRecordset);
  $totalRows_rsRecordset = mysql_num_rows($rsRecordset);
	$url='http://www.miosito.com/'.str_replace(' ', '-', strtolower($row_rsRecordset['regione'])).'/';
	$q="SELECT * FROM province WHERE sigla='$row_rsRecordset[provincia]'";
	$r=mysql_query($q) or die(mysql_error());
	$w=mysql_fetch_array($r);
	$url=$url.str_replace(' ', '-', strtolower($w['nome'])).'/';
	$url=$url.str_replace(' ', '-', strtolower($row_rsRecordset['citta'])).'/';
	$url=$url.purifica($row_rsRecordset['idAnnuncio'].'_'.str_replace(' ', '-', strtolower($row_rsRecordset['tipo_contratto'])).'-'.str_replace(' ', '-', strtolower($row_rsRecordset['tipologia'])).'-'.str_replace(' ', '-', strtolower($row_rsRecordset['citta']))).'.html';
  	$pub_date=date('d/m/Y', $row_rsRecordset['data_annuncio']);
	#$pub_date=$pub_date.'T19:00:05+00:00';
	
  // START STORING DATA IN VARIABLE TO PLACE IN XML FILE
  if($totalRows_rsRecordset > 0) {
 $strXML = "<?xml version=\"1.0\"?>\n";
    
  // STORE NAME OF TABLE
  $strXML = $strXML . "<item>\n";
  
  // STORE FIELD AND FIELD DATA IN ONE HIARCHY, REPEAT FOR MULTIPLE FIELDS
  do {
  $strXML = $strXML."<notizia>\n";
  $strXML = $strXML."<id>".$row_rsRecordset['idAnnuncio']."</id>\n";
  $strXML = $strXML."<description> ".$row_rsRecordset['descrizione']." </description>\n";
  $strXML = $strXML."<publish_date> ". $pub_date ." </publish_date>\n";
  $strXML = $strXML."<province> ".$row_rsRecordset['provincia']." </province>\n";
  $strXML = $strXML."<locality>".$row_rsRecordset['citta']."</locality>\n";
  $strXML = $strXML."<full_address> ".$row_rsRecordset['indirizzo'] ." </full_address>\n";
  $strXML = $strXML."<address>".$row_rsRecordset['indirizzo']."</address>\n";
  $strXML = $strXML."<advertiser>".$row_rsRecordset['nomeAgenzia']."</advertiser>\n";
  $strXML = $strXML."<phone_number>".$row_rsRecordset['fissoAgenzia']."</phone_number>\n";
  $strXML = $strXML."<phone_number2> ".$row_rsRecordset['cellAgenzia']." </phone_number2>\n";
  $strXML = $strXML."<listing_type>" . $row_rsRecordset['tipo_contratto'] . "</listing_type>\n";  
  $strXML = $strXML."<property_type>".$row_rsRecordset['tipologia']."</property_type>\n";
  $strXML = $strXML."<area>".$row_rsRecordset['metri_quadri']." </area>\n";
  $strXML = $strXML."<price> ".$row_rsRecordset['prezzo']." </price>\n";
  $strXML = $strXML."</notizia>\n";
  } while ($row_rsRecordset = mysql_fetch_assoc($rsRecordset)); 
  
  $strXML = $strXML . "</item>";
  
  // OPEN FILE, WRITE TO FILE, CLOSE FILE, CLOSE RECORDSET
  $XMLFile = fopen("news.xml", "w") or die("can't open file");
  
  fwrite($XMLFile, $strXML);
  fclose($XMLFile);
}
  mysql_free_result($rsRecordset);
 
Grazie