473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

creating XML with embedded PHP

Hi-

I am attempting to set up an RSS feed using PHP. It would be convenient for
me to embed PHP into an xml file like I would do to an HTML file in order to
create the XML, however the apache server does not realize that it's PHP
content and the PHP engine is not run against that code. so I have to call
it feed.php instead of feed.xml, and most of the rss readers don't
appreciate this.

My alternative is to create the XML file every day or so (using PHP or
whatever), however that does not guarantee that the person requesting the
rss feed gets up to date info.

I would really like to know if there is a way to create the XML file on the
fly using PHP without modifying the apache server.

Thanks,
troy
Jul 17 '05 #1
6 7359
On Mon, 05 Jan 2004 21:54:49 GMT, "Troy" <tr**@morpheus.No_SpAm.net> wrote:
I am attempting to set up an RSS feed using PHP. It would be convenient for
me to embed PHP into an xml file like I would do to an HTML file in order to
create the XML, however the apache server does not realize that it's PHP
content and the PHP engine is not run against that code. so I have to call
it feed.php instead of feed.xml, and most of the rss readers don't
appreciate this.
They _shouldn't_ care so long as you send the appropriate Content-type header
(Content-type: application/xml , I think).
My alternative is to create the XML file every day or so (using PHP or
whatever), however that does not guarantee that the person requesting the
rss feed gets up to date info.

I would really like to know if there is a way to create the XML file on the
fly using PHP without modifying the apache server.


Depends whether you count this as "modifying" the server, but a ForceType
directive in a .htaccess file might do the trick:

http://httpd.apache.org/docs-2.0/mod...html#forcetype

<Files "feed.xml">
ForceType application/x-httpd-php
</files>

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2
Try putting a dummy .xml filename into the url.

http://www.somewhere.krakow.pl/feed.php/feed.xml

When Apache fails to find the file /.../feed.php/feed.xml, it'll run
/.../feed.php instead.

Setting the content-type header should work though. And depending on how
popular the feed is, generating a static version of the file isn't a bad
idea. You would update the file whenever you add a new story. Since that
should happen less often then retrieval of the feed, it's more efficient.

Uzytkownik "Troy" <tr**@morpheus.No_SpAm.net> napisal w wiadomosci
news:J2******************@newssvr30.news.prodigy.c om...
Hi-

I am attempting to set up an RSS feed using PHP. It would be convenient for me to embed PHP into an xml file like I would do to an HTML file in order to create the XML, however the apache server does not realize that it's PHP
content and the PHP engine is not run against that code. so I have to call it feed.php instead of feed.xml, and most of the rss readers don't
appreciate this.

My alternative is to create the XML file every day or so (using PHP or
whatever), however that does not guarantee that the person requesting the
rss feed gets up to date info.

I would really like to know if there is a way to create the XML file on the fly using PHP without modifying the apache server.

Thanks,
troy

Jul 17 '05 #3
"Troy" <tr**@morpheus.No_SpAm.net> schreef in bericht
news:J2******************@newssvr30.news.prodigy.c om...
I am attempting to set up an RSS feed using PHP. It would be convenient for me to embed PHP into an xml file like I would do to an HTML file in order to create the XML, however the apache server does not realize that it's PHP
content and the PHP engine is not run against that code. so I have to call it feed.php instead of feed.xml, and most of the rss readers don't
appreciate this.


Is it an idea to keep the script named feed.php, but make the url point to
feed.php?ext=.xml
The script would of course do nothing with the extra variable that is
created with this method, but it might satisfy the RSS readers. I really
wouldn't know, cuz I know nothing about RSS at all, but it was just an idea
not including server modifications.

Remon.
Jul 17 '05 #4
Hello,

On 01/05/2004 07:54 PM, Troy wrote:
I am attempting to set up an RSS feed using PHP. It would be convenient for
me to embed PHP into an xml file like I would do to an HTML file in order to
create the XML, however the apache server does not realize that it's PHP
content and the PHP engine is not run against that code. so I have to call
it feed.php instead of feed.xml, and most of the rss readers don't
appreciate this.

My alternative is to create the XML file every day or so (using PHP or
whatever), however that does not guarantee that the person requesting the
rss feed gets up to date info.

I would really like to know if there is a way to create the XML file on the
fly using PHP without modifying the apache server.


You may want to try these classes to generate a XML RSS feed:

http://www.phpclasses.org/rsswriter

http://www.phpclasses.org/xmlwriter

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #5
Chung suggested this and I agree that it makes a lot of sence to update the
XML file only after submission of new stuff.
And depending on how popular the feed is,
generating a static version of the file isn't a bad
idea. You would update the file whenever you
add a new story. Since that should happen
less often then retrieval of the feed, it's more efficient.


This works, except in order to create the file in public_html/rss I need to
alter the permissions on feed.xml to 666 since my the webserver user had no
permission to write in my personal user directory. I don't want to leave it
with 666 perms, so is there another way to do this, or should I let the
webserver user own that file?

Thanks!
troy
Jul 17 '05 #6
The answer is nope, unless your're the server administrator.

Uzytkownik "Troy" <tr**@morpheus.No_SpAm.net> napisal w wiadomosci
news:Tl********************@newssvr30.news.prodigy .com...
Chung suggested this and I agree that it makes a lot of sence to update the XML file only after submission of new stuff.
And depending on how popular the feed is,
generating a static version of the file isn't a bad
idea. You would update the file whenever you
add a new story. Since that should happen
less often then retrieval of the feed, it's more efficient.
This works, except in order to create the file in public_html/rss I need

to alter the permissions on feed.xml to 666 since my the webserver user had no permission to write in my personal user directory. I don't want to leave it with 666 perms, so is there another way to do this, or should I let the
webserver user own that file?

Thanks!
troy

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Kerri McDonald | last post by:
We have an application where the user fills out many screens and when they are done, we are supposed to display the text they entered in a word or excel format. That is fairly easily accomplished...
2
by: David L | last post by:
Apologise for a question from someone new to XML. I would like to create through program (e.g. VB6), a valid and well formed XML document which consists of embedded XML documents of various...
3
by: Edward Diener | last post by:
I am creating a component and I want one of my properties to be an embedded class with its own properties. When the component designer shows this property I want it to be able to expand this...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
3
by: Craig Jurney | last post by:
Am having difficulty creating a dynamic <select> element using direct assignment to the element's option array (ie. someElement.option=new Option(someText, someValue);) that will work on Palm...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
2
by: SAL | last post by:
I would like to create a VB.net function, that builds a dynamic hyperlink using System.Web.UI.WebControls.HyperLink, but I can not find any examples on how to generate a dynamic hyperlink. Has...
4
by: Michel Verhagen | last post by:
Hi, I want to create a DTD in an XML file in memory. The XML file is created using the DOM in C#. I am new to all this, but couldn't find anything about creating DTD's using the DOM (well, I...
4
by: pbd22 | last post by:
Hi. I am playing with the idea of creating a embedded movie player for my site. The player must not be a downloadable software, but something that can stream videos. I know that there are a lot...
1
by: Abdo Haji-Ali | last post by:
Previously I used to create user controls if I wanted to use a specific set of controls in multiple pages, however I want to deploy my control in other applications so I thought of creating custom...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.