2014-02-12 82 views
0

我的提要是用PHP和MYSQL製作成XML然後feedburner。PHP和XML:Dlvr.it不起作用

我的問題是,dlvr.it無法在每次發佈時都讀取新條目。

這裏是我的PHP代碼:

<?php 
include('db.php'); 

header('Content-Type: text/xml'); 
echo '<?xml version="1.0" encoding="ISO-8859-1"?> 
<rss version="2.0"> 
<channel> 
<title>MindWeather Thesis</title> 
<description>Latest News from my website</description> 
<link>http://www.mindweather.info</link>'; 

$get_articles = "SELECT Fore_ID, Valid, Synopsis, 
DATE_FORMAT(Issued,'%a, %e %b %Y %T') as formatted_date 
FROM tblforecast ORDER BY Issued DESC LIMIT 15"; 

$articles = mysql_query($get_articles) or die(mysql_error()); 

while ($article = mysql_fetch_array($articles)){ 

    echo ' 
     <item> 
      <title>'.$article['Valid'].'-hour Forecast</title> 
      <description><![CDATA['.$article['Synopsis'].']]> </description> 
      <link>http://mindweather.info/fforecast.php?fore='.$article['Fore_ID'].'</link>  
      <pubDate>'.$article['formatted_date'].' GMT</pubDate> 
     </item>'; 
} 
echo '</channel> 
</rss>'; 
?> 

的FeedBurner資訊位於:http://www.mindweather.info/feedz2.php

你的回答會是有很大幫助。謝謝!

+0

「不起作用」是我們理解問題的不充分說明。當你嘗試時發生了什麼?你收到錯誤信息了嗎?你得到不正確的結果了嗎? –

+0

它顯示結果並沒有錯誤信息。 – Clary

回答

0

檢測Feed中新條目的機制是使用其唯一的<guid>來識別它們。由於您的Feed缺少該元素,因此該服務無法檢測到新條目是非常正常的。

這是一樣簡單的添加如:<guid><?php echo $article['Fore_ID']; ?></guid>,假設當然Fore_ID是獨一無二的。加入他們<item></item>

之間還應該確保每個<link>元素是唯一的,因爲這是另一種方式的feed閱讀器嘗試,當他們不這樣做,使用<guid>元件以檢測新的/唯一條目。

+0

哪部分我必須添加指導? – Clary

+0

我做了現在唯一的鏈接,但它仍然無法正常工作。 (以上更新代碼) – Clary

+0

不確定你做了什麼,但仍然沒有元素:http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.mindweather.info%2Ffeedz2 .PHP –