1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
<?php
$xml = '<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0">';
$xml .= '<channel>';
$xml .= '<title>MonTitre</title>';
$xml .= '<link>http://www.monsite.net</link>';
$xml .= '<description>Mon Site est le meilleur</description>';
$xml .= '<copyright>© MonSite 2005</copyright>';
$xml .= '<language>fr</language>';
$xml .= '<image>';
$xml .= ' <title>MonSite</title>';
$xml .= ' <url>http://www.MonSite.net/images/MonImage.gif</url>';
$xml .= ' <link>http://www.MonSite.net</link>';
$xml .= '</image>';
$jourdui= date("D, d M Y H:i:s +0100");
//Sat, 23 Apr 2005 00:01:00 +0100
$xml .= '<pubdate>'.$jourdui.'</pubdate>';
$base = mysql_connect ('');
mysql_select_db (');
$res=mysql_query("select * from gites order by id desc limit 0, 10");
// extraction des 10 dernières nouvelles
while($lig=mysql_fetch_array($res)){
$titre=$lig[nomGite];
$adresse=$lig[id];
$contenu=$lig[descriptionGite];
$madate=$lig[date];
$datephp=date("D, d M Y H:i:s +0100", strtotime($madate));
$xml .= '<item>';
$xml .= '<title>'.$titre.'</title>';
$xml .= '<link>http://www.annuaire-les-vacances.com/infos.php?id='.$adresse.'</link>';
$xml .= '<pubDate>'.$datephp.'</pubDate>';
$xml .= '<description>'.$contenu.'</description>';
$xml .= '</item>';
}//fin du while
$xml .= '</channel>';
$xml .= '</rss>';
$fp = fopen("fluxrss.xml", 'w+');
fputs($fp, $xml);
fclose($fp);
?> |