Solved

Outputting Twitter Atom in Coldfusion

Posted on 2009-04-10
3
603 Views
Last Modified: 2013-12-16
I grabbed the RSS info for a twitter search, but I'm unable to output it in Coldfusion MX 7 (can't use cffeed).

This is the URL: http://search.twitter.com/search.atom?q\x3d+%23activityTracker+from%3Awomenshealth

I've tried a couple different scenarios, but I all I get is errors. I tried using HTTP but it seems like it is looking for the data in XML, but Twitter is giving it to me in Atom. The code below give this error: "Element RSS.CHANNEL.ITEM is undefined in XMLCONTENT. "

I'm looking for a complete code sample if possible. But any help is very much appreciated.
<cfhttp url="http://search.twitter.com/search.atom?q\x3d+%23activityTracker+from%3Awomenshealth" method="GET"></cfhttp>
 
<cfscript>
XMLContent = trim(cfhttp.filecontent);
XMLContent = XMLParse(XMLContent);
</cfscript>
<cfloop from="1" to="#ArrayLen(XMLContent.rss.channel.item)#" index="idx">
<cfoutput>
Author: #XMLContent.rss.channel.item[idx].author.xmlText#<BR>
</cfoutput>
<hr>
</cfloop>

Open in new window

0
Comment
Question by:haboltn
  • 2
3 Comments
 
LVL 4

Expert Comment

by:BSSupport
ID: 24145078
That URL doesn't return any results for me.

Anyway, yes, the result is an Atom feed: xmlns="http://www.w3.org/2005/Atom"

So no, yo won't find any rss.channel.item objects or anything else conforming to the RSS standard.

Search the XML for items using the Atom format, when there are some to find, and you'll get your results.
0
 

Author Comment

by:haboltn
ID: 24147756
BBS - The URL is for a feed, so it wouldn't return a page. My question was that  I was looking for a way to search the XML in Atom format. Thanks anyway.
0
 

Accepted Solution

by:
haboltn earned 0 total points
ID: 24147783
Ended up using javascript from the Twitter API


<div id="twitter_div" style="margin-top:0px;">                
  <ul id="twitter_update_list">
    <li class="hidden">&nbsp;</li>
  </ul>
</div>
<!--put this right before the </body> tag so twitter doesn't hang up your page load.-->
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/womenshealth.json?callback=twitterCallback2&amp;count=3"></script>

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Select distinct 25 102
How to find the first line of javascript code-behind of a web page button. 7 74
Macro to import XML in Access 2013 2 40
XSLT Display Label Name 1 22
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

803 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