Problème avec la création de mon flux RSS
Bonjour tout le monde, voila j'ai suivi le tuto pour créer mon propre flux rss mais j'ai un soucis.
Voici le code :
Code:
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
| <?php
$cnx = mysql_connect('localhost','root','');
$db = mysql_select_db('rss',$cnx);
$xml = '<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0">';
$xml .= '<channel>';
$xml .= '<title>..:: Ash\'s Blog - RSS ::..</title>';
$xml .= '<link>http://romain.bertolucci.free.fr/site/</link>';
$xml .= '<description>Le blog de Ash, des articles sur WoW, WaR, developpement web, bonne lecture!</description>';
$sql = "SELECT *,DATE_FORMAT(date_news,'%d %b %Y %h:%i:%s') AS date FROM blog_news ORDER BY id_news DESC LIMIT 0,10";
$req = mysql_query($sql) or die("Erreur RSS");
while($data = mysql_fetch_array($req))
{
$id = $data['id_news'];
$date = $data['date'];
$titre = $data['titre_news'];
$accroche = $data['accroche_news'];
$texte = $data['texte_news'];
$lien = 'http://romain.bertolucci.free.fr/site/?r=lire&id='.$id;
$xml .= '<item>';
$xml .= '<title>'.$titre.'</title>';
$xml .= '<link>'.$lien.'</link>';
$xml .= '<pubDate>'.$date.' GMT</pubDate>';
$xml .= '<description>'.$accroche.'</description>';
$xml .= '</item>';
}
$xml .= '</channel>';
$xml .= '</rss>';
$fp = fopen("../rss.xml", 'w+');
fputs($fp, $xml);
fclose($fp);
mysql_close($cnx);
echo '<SCRIPT LANGUAGE="JavaScript">document.location.href="index.php"</SCRIPT>';
?> |
Le code marche bien, donc le fichier rss.xml est bien crée, mais quand je vais dessus pour le lire, alors la ca ne marche plus.
Apres moulte essai j'ai trouvé la source du problème, c'est apparement la variable $lien qui pose problème, mais moi je veux conserver ce lien pour que la personne soit directement dirigé vers l'article en question...
Comment puis faire ?
Merci !