[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Listing Twitter Feed in ColdFusion 7

Posted on 2009-12-27
9
Medium Priority
?
350 Views
Last Modified: 2013-11-18
I am porting a ColdFusion site to GoDaddy, which has an older version (7).  I want to list the most recent feeds like I have at www.joyofritual.com in the bottom right corner.  

I can't use CFFEED.  Is there a way to replicate the attached code without CFFEED?
<cfset feedurl = "http://twitter.com/statuses/user_timeline/56786200.rss" />
			<cftry>
				<cffeed source="#feedurl#" properties="feedmeta" query="feeditems" />
				<ul id="navlist">
				<cfoutput query="feeditems" maxrows="5">
					<li><span class="BODY">#right(feeditems.content,len(feeditems.content)-15)#</span></li>
				</cfoutput>
				</ul>

			
				<cfcatch>
					<cfoutput>
						Twitter temporarily off line.
					</cfoutput>
				</cfcatch>
			</cftry>

Open in new window

0
Comment
Question by:dougfosterNYC
  • 5
  • 3
9 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 26128332
This looks like a site that matters to someone's livelihood.  Why would you want to put it on GoDaddy when there are other hosts that have current CF hosting available?  See the recommendations here:
http://www.adobe.com/products/coldfusion/hosting/

I would reconsider the strategy of trying to shoe horn this into GoDaddy.  The money you save, if any, is likely to be eaten up the first time you need to ask them for tech support.
0
 

Author Comment

by:dougfosterNYC
ID: 26132111
Well, I already have an account with a bunch of websites.  All my new sites are on hostgator, which I love.  But this is CFand the hosting is already paid for.  The site is working now, so this is the last remaining issue.

So, how about the original question?  How can I get a list of the last 5 feeds from a Twitter account?
0
 
LVL 4

Accepted Solution

by:
sandy12879 earned 2000 total points
ID: 26135686
Well if you need to read the rss.xml... below code can help you..

<cfset urlAddress="http://twitter.com/statuses/user_timeline/56786200.rss">
<cfhttp url="#urlAddress#" method="GET" throwonerror="yes" resolveurl="yes"/>
<!---validation flag --->
<cfset XMLVALIDATION = true>
<cftry>
<cfset fileCont= trim(cfhttp.FileContent)>
<!---create the xml document object--->
<cfset xmlDoc = xmlParse(fileCont, false)>

Let me know if it works for you ...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dougfosterNYC
ID: 26137540
CFFEED, which I can't use because I am going to use CF7, does a great job parsing out the content to output a list of items.  That is what I want, a list of their last Twitter submissions like at the bottom right of the current site at www.joyofritual.com.  That uses CFFEED, and that is what I want the output to be.

Any way to get just the content and not the other stuff?
0
 

Author Comment

by:dougfosterNYC
ID: 26142890
Well, I figured out my own problem.

to get a list in ColdFusion 7 use the xmlparse function and use a loop as in the code below....

<cfset urlAddress="http://twitter.com/statuses/user_timeline/56786200.rss">
			<cfhttp url="#urlAddress#" method="GET" throwonerror="yes" resolveurl="yes"/>
			<!---validation flag --->
			<cfset XMLVALIDATION = true>
			
			<cfset fileCont= trim(cfhttp.FileContent)>
			<!---create the xml document object--->
			<cfset xmlDoc = xmlParse(fileCont, false)>
			
			<ul id="navlist">
			<cfoutput>
				<!-- loop through feed items.  Take out initial "barbarabiziou: " text manually by removing first 15 characters. -->
				<cfloop index="x" from="1" to="5"> 
				<cfset theItem = #xmlDoc.rss.channel.item[x].title.xmlText#>
				<li><span class="BODY">#right(theItem,len(theItem)-15)#</span></li>
				</cfloop>
			</cfoutput>			
			</ul>

Open in new window

0
 
LVL 4

Expert Comment

by:sandy12879
ID: 26143159
Well i suggested the same...you just had to play with the variable "XMLDOC' to ge your required result.Glad you figured it out.
0
 
LVL 4

Expert Comment

by:sandy12879
ID: 26143185
Well i suggested the same...you just had to play with the variable "XMLDOC' to ge your required result.Glad you figured it out.
0
 

Author Closing Comment

by:dougfosterNYC
ID: 31670205
This was the correct approach.  I just had to flesh out some details to implement the solution.
0
 

Author Comment

by:dougfosterNYC
ID: 26144773
Thanks Sandy.  Yours was the correct approach.  
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question