2

So I am trying to write a program that will send an RSS feed to every subsriber when a new data base entry is added. The code I have will give the subscriber all of the current db entries, but will not send new RSS feeds when a new item is entered. Here is my code:

<?php
header("Content-Type: application/rss+xml; charset=UTF8_general_ci"); 

//mysql connection is here


$rssfeed = '<?xml version="1.0" encoding="ISO-8859-1"?><rss version="2.0"><channel>';

//rss feed data
$rssfeed .= '<title>test</title>
            //link is here
            <description>test</description>
            <language>en-us</language>';

//items
$results = mysql_query("SELECT name FROM test");

while($row = mysql_fetch_array($results)){ //looping through items
    $rssfeed .= '<item>
                <title>' . $row['name'] . '</title>
                <description>test</description>
                //link to my website here
                <pubDate>' . date("F j, Y, g:i a") . '</pubDate>
                </item>';
}

$rssfeed .= '</channel></rss>';


echo $rssfeed;
  • What's the problem then? – Mike Aug 17 '13 at 21:16
  • Correct me if I'm wrong, but `UTF8_general_ci` looks like a MySQL character set. – Mike Aug 17 '13 at 21:16
  • UTF8_general_ci is a MYSQL character set, this wouldn't cause the problem though would it? The problem is that when they subscribe they get all of the current posts, but when I go to add a new post they do not receive it. In other words it's not updating. – user2692835 Aug 17 '13 at 21:20
  • 1
    Just to make sure that you know this, RSS is a pull technology, so the subscribers (or their feed readers) need to fetch a fresh copy of the feed from the server. If this is not the issue, are the new posts matched by the feed criteria? Are you getting the new posts when you request the feed? – MasterAM Aug 17 '13 at 21:42
  • The new posts are matched by the feed criteria. If you go to the link the new posts are there in the xml but they're not showing up on the reader. – user2692835 Aug 17 '13 at 21:49
  • The reader may be the problem. What reader is that? Have you tried others, such as feedly? You can hint the reader when to refresh. Read [this](http://www.kbcafe.com/rss/rssfeedstate.html) for more information. – MasterAM Aug 18 '13 at 12:24
  • I tried both digg reader and the old reader but neither of them updated. – user2692835 Aug 18 '13 at 15:19
  • I'm experiencing the same problem over local xampp server... I'm not getting updates on Browser addons or android app via http://localhost OR http://192.x – mk117 Jun 29 '14 at 07:26

0 Answers0