PDA

View Full Version : Using a PHP page to RSS?


mangofreak
09-19-2012, 06:32 PM
Hi guys,

I am not familiar with RSS, however I find myself in a position that is forcing me to find out more about it. I created a website for a client. All the pages are in PHP with a mysql db. Now he wants to add RSS to the Website.

My searches point to Feedburner and other services like it. The idea behind the RSS for my client is to allow users to register to his feed and everytime the website is updated, they are notified. Sounds easy but I don't see the beginning of it. Should I convert the content to xml - meaining convert the php oputput to xml?
what is the best way to go about it?

Please need some advice?

johnMoss
09-20-2012, 01:36 AM
Just cause the page is in php doesn't mean you can't toss in some html...
In the case of rss, it boils down to accessing the requested copy & sending it on through a feeder. Did you get a chance to read this article in your search? Pretty well sorts it all out, & has all the links you need to become operational...
http://webdesign.about.com/od/rss/a/link_rss_feed.htm

edbr
09-20-2012, 01:58 AM
there are some scripts around that take data from the database and basically re write it as a readable Rss feed if thats what you mean.

Here is a simple one i use, this tells the reader that the page is xml although the actual page is called ( in my case) rss.php.

<?php

echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo '<rss version="2.0">';
echo '<channel>';
echo '<title>MyRSS Feed</title>';
echo '<link>http://www.mydomain.com</link>';
echo '<description>This RSS feed of the latest stuff .</description>';


require_once('../Connections/test.php');

$query_Recordset1 ="SELECT JOBNO,jbdes,requirefor,salary,UNIX_TIMESTAMP(daten ow) AS datenow
FROM position2 ORDER by JOBNO DESC LIMIT 0,15";


$Recordset1 = mysql_query($query_Recordset1) or die(mysql_error());

$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$id= $row_Recordset1['JOBNO'];

while($row_Recordset1 = mysql_fetch_assoc($Recordset1)){
echo '<item>'; // Begin a news article
echo '<title>' ."JOB #".$row_Recordset1['JOBNO'].'</title>';
echo '<link>'."http://wwwmydomain.com/Detail.php?recordID=".$row_Recordset1['JOBNO'].'</link>';
echo '<description>'.htmlentities(strip_tags($row_Recordset1['jbdes'])) . "in " .strip_tags($row_Recordset1['requirefor'])."Salary ".htmlentities( strip_tags($row_Recordset1['salary'])). '</description>';

echo '<datenow>'.date('D, d M Y H:i:s',$row_Recordset1['datenow']).'</datenow>';
echo '</item>';
}

echo '</channel>';
echo '</rss>';

mangofreak
09-20-2012, 04:11 PM
John and Edbr,

Thank you for rreplying. I will read the article and EDBR, to tell you the truth, I don't clearly know what I was saying otherwise my posting would have been more detailed.

Yes, my site is a PHP site and has a database... I will test the script you mentioned and I found some other tutorial on it as well.

I'll keep you updated on my progress.

Cheers.

mangofreak
09-20-2012, 04:19 PM
What I don't want is, to do display the feed on the site.

What I want is, to convert the content of few pages that change with some frequency and broadcast the changes either as a notice or (that is what I don't know) whatever so the registered user to my feed, know what is happening.

I can't explain it any simpler than that and I believe a script like edbr would do the trick...I hope :)

domedia
09-20-2012, 05:12 PM
Then you want an RSS feed like Ed talked about.