I created my own feed for my website and connected it to feedburner and to dlvr.it for dissemination to social media sites.
However, whenever I create a new post in my site, it takes a few minutes to post to feedburner (which is not really a problem) and it does not post updates to my social media accounts and upon viewing dlvr.it's reports, it says 'no items found via pull'
My complete code for my xml which is connected to feedburner goes like this:
<?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.MySite.info</link>';
$get_articles = "SELECT ID, NewsType, Content,
DATE_FORMAT(DateTime,'%a, %e %b %Y %T') as formatted_date
FROM tblnews ORDER BY DateTime DESC LIMIT 15";
$articles = mysql_query($get_articles) or die(mysql_error());
while ($article = mysql_fetch_array($articles)){
echo '
<item>
<title>'.$article['NewsType'].'</title>
<description><![CDATA['.$article['Content'].']]></description>
<link>http://www.MySite.info</link>
<pubDate>'.$article['formatted_date'].' GMT</pubDate>
</item>';
}
echo '</channel>
</rss>';
?>
What's wrong?
First of all, move the
header()
call up before your firstecho()
. You should always output headers before any other output, because they put information into the HTTP header, which should always be complete before the actual body starts appearing. As it says in the manual:Second, let's have a look at the output you're generating. You've not provided the output from your PHP (FeedBurner changes things on the way through to try to help make feeds more valid/useful), but this is roughly what you're generating, assuming a single item in the database:
So, there's a few problems there. You can compare your output with the RSS spec, or run it through the W3 Feed Validator Service to get some tips, or even compare your feed to a basic example, like the one on Wikipedia, but basically:
The word "Mindweather" appears in an invalid place. Remove it, or move it where it needs to be. Is it the title of the feed? If so, it should be where "MyProj" is, in the
<title>
of the<channel>
."http://www.MySite.info" appears in an invalid place. If that's meant to be a link to your site, it should be in the
<link>
element of the<channel>
, near the end, where you haveecho "<link>MyProj/link>
(While I'm there, you're missing the open angle bracket from the
</link>
on that line, too.)Your
<channel>
's<link>
element should be before all your items.Your
<channel>
needs a<description>
element.On top of that, you don't have a
pubDate
or aguid
element in your feed.Even though
pubDate
andguid
are technically optional, things that regularly pull content from RSS feeds tend to look for one or both of them to see if they've seen them before or not. The pubDate should be the publication date of the new item, and the guid should be a unique identifier for it (often the URL of the specific item is used.) See the RSS 2.0 spec for more details.For example, often something that's pulling from a feed will only pick up items from the last 30 days, say, so it'll look for any
item
s with a pubDate more recent than that. If none of your items have a pubDate, it won't "see" any of them.When I'm developing a feed, I'll generally grab an example as a template and make my output look like that, only with my details in it.
Finally, bear in mind that the mysql extension is deprecated, and will be removed from future versions of PHP. You shouldn't be using it for new code.