>- see footer for list info -<
Thought it might be useful just in case anyone is remotely consuming Twitter
feeds that require basic authentication - Twitter is turning off this
ability at the end of the month.

I just by chance happened to notice this in someone else's Twitter feed (an
automatic service that published the Large Hadron Collider's current status
to Twitter) so it was lucky I saw it (I should have been following
@twitterAPI to be honest).

Twitter will now be using a token-based authentication service (OAuth) which
is a bit of a pain, but luckily I found Rob O'Brien's post about using
Twitter4J to handle all the tricksy bits:

http://blog.robobrien.com/integrating-twitter-and-oauth-with-coldfusion/

Handy tool, and removed a lot of lines of code in my previous feed
consumption scripts. If you're doing anything with Twitter feeds, you might
want to check it out before the end of the month.

Basically to get each new Tweet is as easy as this:

<cfset objTwitter = createObject("java", "twitter4j.Twitter")>
<cfset
objTwitter.setOAuthConsumer(application.twitter.consumer_Key,application.twitter.consumer_Secret)>
<cfset
objTwitter.setOAuthAccessToken(application.twitter.access_key,application.twitter.Access_Secret)>
<cfset arrFeed = objTwitter.getUserTimeline()>

<cfloop array="#arrFeed#" index="tweet">
    <cfset stTweet =
{id=tweet.getID(),text=tweet.getText(),date=parseDateTime(tweet.getCreatedAt()),isReply=tweet.getInReplyToUserID(),source=tweet.getSource(),is_retweet=tweet.isRetweet()}>
    <cfdump var="#stTweet#">
</cfloop>

There's loads of other useful stuff in there as well to let you post new
tweets, get retweets, basically build a whole client if you needed to. Just
cfdump one of the arrFeed's members above to see the plethora of methods
available.

Hope this is useful to someone.
Rich
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to