Conner Hasbrouck
Conner Hasbrouck

Reputation: 21

How to retrieving <content:encoded> from a Wordpress RSS feed using Cold Fusion

My Wordpress site is https://chasbroucktest.wordpress.com/2015/07/27/home/ and its RSS Feed is https://chasbroucktest.wordpress.com/feed/. I am trying to grab all the content from within "content:encoded" including the html tags. So far I have the RSS feed reading in.

<cfset rssUrl = "https://chasbroucktest.wordpress.com/feed/">            
<cffeed action="read" source="#rssUrl#" query="entries" properties="info">

How do I call and output the content within "content:encoded"?

Upvotes: 0

Views: 375

Answers (1)

robenrajan
robenrajan

Reputation: 355

I suggest an alternative solution using cfhttp tag. Read the rss and parse the xml into object and search for content:encoded

Here is a sample code.

<cfset rssUrl = "https://chasbroucktest.wordpress.com/feed/">

<cfhttp url="#rssUrl#" result="hello">

<cfset data = XmlParse(hello.Filecontent)>
<cfset content = XmlSearch(data,"//content:encoded/text()")>
<cfloop array="#content#" index="feed">
    <cfoutput>#feed.XmlValue#</cfoutput>
</cfloop>

Upvotes: 1

Related Questions