What is the best way to pass HTML code for embed via rss channel to rss parser in php?

I am trying to put HTML code for embedding flash video in rss feed which will then be the parser of the parser (magpie) on my other site. How can I encode the embed code on one side and then decode it on the other so that I can insert pure html into the DB on the receiving server?

+3
html xml php validation rss
source share
5 answers

Since RSS is XML, you can check out CDATA, which I believe is valid in various RSS specifications.

<summary> <! [CDATA [Data here]]>

Here's the w3schools entry on it: http://www.w3schools.com/XML/xml_cdata.asp

+1
source share

htmlencode / htmldecode should do the trick.

0
source share

I used htmlentities / html_entity_decode, but for some reason it does not work with the parser. In a normal test, it works, but the parser always returns the html code without <> ".

0
source share

RSS is XML. It has very specific rules for HTML coding. If you generate it, I would recommend using the xml library to write the node HTML code to make sure that you code correctly.

HTMLencode will only perform the escaping required to embed data in HTML, XML rules are more stringent.

0
source share

Instead of writing your own RSS feed, consider using the Django syndication framework with django.contrib.syndication :

https://docs.djangoproject.com/en/dev/ref/contrib/syndication/

It also supports attachments, which are an RSS method for embedding images or videos.

For custom tags, there is also a lowlevel API that allows you to modify XML: https://docs.djangoproject.com/en/dev/ref/contrib/syndication/#the-low-level-framework

0
source share

All Articles