|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Article Discussion: Building a Generic RSS Class With PHP
Building a Generic RSS Class With PHP If you have any questions or comments about this article then please post them here.
You can read the article here . |
|
#2
|
|||
|
|||
|
Invalid RSS
Sadly, what you have here is an example of how confusing the multiple RSS specs can be.
In 0.90/1.0, image and items are children of the root rdf:RDF element, in 0.91/2.0 they are children of the channel element. But you are building a mishmash, a file that claims to be 0.91, with an 0.91 root element, but 0.90/1.0 structure. To compound the confusion, on page two you discuss building up this 0.90.5ish file, with a doctype and an rss root element, and then present an 0.90 file with no doctype and an rdf:RDF root element for validation. |
|
#3
|
|||
|
|||
|
RSS feeds by topic?
Hi,
nice article, even if I learned nothing, being a RSS user for a while... ![]() I have indeed created a small and simple PHP class that does exactly the opposite of yours: it take the URL of a RSS feed, and changes it to HTML code. it is called phpSyndication, and is available here: URL Anyway, I just would like to know why devArticles proposes just one general RSS feed, instead of this general and one for each topic, such as PHP or ASP? I would like for example to put devArticles' RSS feeds on phpHeaven, but I'm obviously only interested in PHP articles... ![]() On phpHeaven, RSS feeds are available on base of each directory of the content tree, so that you can syndicate only the one you need. Regards, Nicolas. |
|
#4
|
|||
|
|||
|
sample?
Hey Mitch-
Do you have an .xml file location that shows the output format from this? I'd like to run it through a RSS validator before I start hacking away at this with my own personal changes to it. Thanks! |
|
#5
|
|||
|
|||
|
It's not valid RSS, but it's not too difficult to make it valid: mostly you just need to move the line in class.myRSS.php that writes the </channel> tag down to immediately above the line that writes the </rss> tag, since in RSS 0.91 items are inside the channel, not outside. However, if there's the slightest chance that your titles or descriptions will ever have quotes, apostrophes, ampersands, or less-than or greater-thans in them (or if they contain HTML), it's a good idea to run them through htmlspecialchars to escape anything that will cause you to produce invalid XML:
PHP Code:
|
|
#6
|
|||
|
|||
|
I don't know. I tried to add URL to NewzCrawler and it isn't going for it. Sends back an error "Error Parsing XML: Unsupported Newsfeed Format"
When trying to add this sample from my server, I get "Failed: Zero Length Reply." (URL) Is this because the file ends in .php vs .xml? Is it NewzCrawler? ![]() |
|
#7
|
|||
|
|||
|
Looks to be a NewzCrawler problem - I added your feed in half a dozen other RSS readers with no problem, and in fact if you uncheck NewzCrawler's "download and verify" option while adding it, it works just fine in NewzCrawler. It's not the .php that's the problem - I added several of my own .php feeds to NewzCrawler without getting that "zero length reply." Dunno, at this point I can't even remember why I stopped using NewzCrawler.
|
|
#8
|
|||
|
|||
|
Yeah I verified my feed and the devarticles feed through a couple of RSS validators and passed with flying colors.
I'm able to add my feed and the devarticles feed to NewzCrawler, by unchecking the verify feature, but it won't pull news back-just adds the feed location, but no data. Any suggestions for an alternate, yet fully featured reader besides NewzCrawler? Also, on a different note, is it acceptable for the feed location to have variables at the end of the URL? For instance, URL ? Or does the standard call for specific extensions (.xml, .php, .asp etc)? Finally, I wrote Ben Hammersley (Author of an upcoming RSS book on O'Reilly) about the status of RSS in general. Do you think it's on the upswing, downswing or just kind of neutral right now? It's seems odd to me that it's been sitting around as a standard (Even if an evolving one.) for some time, but main street isn't too aware of it. Thanks! |
|
#9
|
|||
|
|||
|
I don't understand.
What is for what file ? Can you post each code for each page togetter ? example -------------- * rss.xml -------------- code code |
|
#10
|
|||
|
|||
|
image/url in description tag
Hi,
I used the script from this article and it works fine. But I also want to add an URL or image into the description tag. If I want to add an URL for example, I get the following: <item> <title>Auto pech. Maar het komt goed.</title> - <description> <a href="test">test</a> </description> <link>URL</link> </item> It makes a tag from the URL. I want the URL to be part of the description tag. Anyone knows how to do this? Thanks! |
|
#11
|
|||
|
|||
|
Okay, I read through this and I'll admit, I'm not the greatest with either PHP or XML or RSS, but I'm trying to learn. Here's what I've done:
test.php PHP Code:
class.myRSS.php PHP Code:
I don't understand why I'm getting an error, probably because I don't fully understand everything that's going on in both of these pages. Could somebody please help me figure out why this isn't working? Thank you all so much. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > Article Discussion: Building a Generic RSS Class With PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|