Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How to connect a RSS feed with a database?
Old 08-19-2008, 10:59 AM How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
Is there any possibility to create a RSS feed from php and mysql..
I know that xml files do not allow php..but hope someone knows how to do this?
__________________

Please login or register to view this content. Registration is FREE
scutari is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-19-2008, 11:08 AM Re: How to connect a RSS feed with a database?
rezzy's Avatar
Super Talker

Posts: 115
Location: in the interwebz
Trades: 0
What are you trying to do? Are you trying to archive rss entries? This would be possible but would require a bit of work on the programmers end.
__________________

Please login or register to view this content. Registration is FREE

Resnodesigns
rezzy is offline
Reply With Quote
View Public Profile
 
Old 08-19-2008, 12:52 PM Re: How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
I would like to automate the process of entering new data at the rss feed from the mysql database using php..
__________________

Please login or register to view this content. Registration is FREE
scutari is offline
Reply With Quote
View Public Profile
 
Old 08-19-2008, 01:01 PM Re: How to connect a RSS feed with a database?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
I have a tutorial in my signature that should help.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 08-19-2008, 02:02 PM Re: How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
I checked it out right now..That was the initial idea I had for that...and you can check this article here--> http://forums.digitalpoint.com/showthread.php?t=986765..

But I think you cannot use php inside xml, I just tried yesterday..
__________________

Please login or register to view this content. Registration is FREE

Last edited by scutari; 08-19-2008 at 02:11 PM..
scutari is offline
Reply With Quote
View Public Profile
 
Old 08-19-2008, 02:21 PM Re: How to connect a RSS feed with a database?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
You can, but the file has to have a php file extension. There is no specification anywhere that states what file extension an RSS feed needs to have, so you can create your XML as normal and then echo your dynamic components in the appropriate places.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 08-19-2008, 02:28 PM Re: How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
Please be more accurate, do you mean that I should create a feed with a php extension( I know this could be done)..but I cannot do the reverse, i tried yesterday but a file like: myfeed.xml does not recognize php.

though bookmarked your tutorial, I liked it very much..thanks
__________________

Please login or register to view this content. Registration is FREE

Last edited by scutari; 08-19-2008 at 02:31 PM..
scutari is offline
Reply With Quote
View Public Profile
 
Old 08-19-2008, 02:35 PM Re: How to connect a RSS feed with a database?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
I've not tested it, but as far as I know, you cannot create a dynamic feed with a .xml extension because your server won't know to parse files with that extension as PHP and so the code won't function because it never executed. There may be a way to tell it to do that, but it's just as easy to use the .php file extension.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 08-19-2008, 02:46 PM Re: How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
well, i know now what you mean but is it sure if a feed reader can a recognize a php file as a feed..I will make a try later on my browser..
__________________

Please login or register to view this content. Registration is FREE
scutari is offline
Reply With Quote
View Public Profile
 
Old 08-19-2008, 02:51 PM Re: How to connect a RSS feed with a database?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
It will validate as a feed.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 08-19-2008, 03:28 PM Re: How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
Ok thanks again
__________________

Please login or register to view this content. Registration is FREE
scutari is offline
Reply With Quote
View Public Profile
 
Old 08-19-2008, 06:20 PM Re: How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
As I tried right now, it won't work. There comes an error that does not recognize xml..

Parse error: syntax error, unexpected T_STRING in C:\wamp\www\rss.php on line 10


__________________

Please login or register to view this content. Registration is FREE
scutari is offline
Reply With Quote
View Public Profile
 
Old 08-20-2008, 06:03 AM Re: How to connect a RSS feed with a database?
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
1. You may use mod_rewrite to rewrite requests to some /feed.xml to /feed.php
or
2. You may generate the static xml file periodically using cron jobs or on ob demand with your script

And don't forget to send correct Content-type if you prefer dynamic way, it should be something like text/xml but I may be wrong about it. Anyway php says text/html by default and thus the RSS client may not accept your feed.

Alsom what is in C:\wamp\www\rss.php on line 10 ?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 08-20-2008, 06:37 AM Re: How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
Quote:
Originally Posted by mtishetsky View Post

Alsom what is in C:\wamp\www\rss.php on line 10 ?
It is the beginning of the xml, <?xml ( i turned off short tags, but no solution)..well you brought some new ideas, but don't know anything about mod_rewrite - is this part of any library?
__________________

Please login or register to view this content. Registration is FREE

Last edited by scutari; 08-20-2008 at 06:40 AM..
scutari is offline
Reply With Quote
View Public Profile
 
Old 08-20-2008, 06:46 AM Re: How to connect a RSS feed with a database?
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
PHP Code:
<?
echo '<?xml version="..." ?>';
?>
<items>
<? foreach ($data as $item): ?>
<item name="<?= $item->name ?>"><?= $item->value ?></item>
<? endforeach ?>
</items>
mod_rewrite is apache module
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 08-20-2008, 06:50 AM Re: How to connect a RSS feed with a database?
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Still I would advise you to go static way and generate the xml file by cron or on demand. This will save you from loading your database with the repeating requests which still wil retrieve one and the same data during some period of time. Also this will allow you increase the speed of serving your feed.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 08-20-2008, 07:19 AM Re: How to connect a RSS feed with a database?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
well, thanks a lot, maybe its better if I switch to creating it manually..
__________________

Please login or register to view this content. Registration is FREE
scutari is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to connect a RSS feed with a database?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.93422 seconds with 12 queries