Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Coldfusion code for twitter updated api v1.1

Posted on 2013-06-12
3
Medium Priority
?
1,308 Views
Last Modified: 2013-09-19
I'm trying to deal with the recently updated twitter API v1.1 to post tweets right from my website to my twitter account, any one can help me with a step by step if possible? I feel I'm missing something!
Here is the code I'm using to post my messages to twitter:
<cfset fullmessage = "My Test Message goes here">
<cfset oauthheader = 'OAuth oauth_consumer_key="xxx", oauth_nonce="xxx", oauth_signature="xxx", oauth_signature_method="HMAC-SHA1", oauth_timestamp="xxx", oauth_token="xxx", oauth_version="1.0"'>
<cfset tweetURL = "https://api.twitter.com/1.1/statuses/update.json">
<cfhttp url="#tweetURL#" method="post" result="resultName">
    <cfhttpparam type="header" name="Authorization" value="#oauthheader#" encoded="yes">
    <cfhttpparam type="formfield" name="status" value="#fullmessage#" encoded="no">
</cfhttp>

Open in new window

any thing wrong with my code above ?! I cannot get this to work ! I am running a windows 2008 R2 64bit dedicated server.
Any help is appreciated.
0
Comment
Question by:mark222
  • 2
3 Comments
 
LVL 16

Expert Comment

by:Gurpreet Singh Randhawa
ID: 39250928
please check this Twitter API by:

http://monkehtweet.riaforge.org/
0
 

Expert Comment

by:sham_CF
ID: 39422573
Hi Mark

You have to pass User_id while posting it to User Time Line API.

Please visit my blog, recently I integrated new Version of API where I bring latest tweets and show it in my Web Page

http://shamcf.blogspot.in/2013/08/get-latest-twit-posted-by-user-using.html
http://shamcf.blogspot.in/2013/08/get-latest-twit-posted-by-user-using_13.html

Thanks
Shambhu
0
 
LVL 16

Accepted Solution

by:
Gurpreet Singh Randhawa earned 2000 total points
ID: 39451737
Here is an CFC which is available on Riaforge, It is available for latest API Version: The Usage is Pretty Simple:

http://monkehtweet.riaforge.org/

The usage Manual is inside the code, but here is the start:

The below goes in Application.cfc

<cfscript>
	application.objTweet = createObject('component','Twitter.com.coldTwitter.monkehTweet').init(
	consumerKey = 'XXXXXXXXXXXXXXXXXXXX',
	consumerSecret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
	oauthToken = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	oauthTokenSecret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	userAccountName = "Your Name",
	parseResults = true
	);
	return true;
	</cfscript>

Open in new window


Below put the code anywhere where you want to show tweets, i prefer an included file

<cfset totalTweets = 4>
<cfset arrStatus = application.objTweet.getUserTimeline() />
<cfif arrayLen(arrStatus) LT totalTweets>
    <cfset totalTweets = arrayLen(arrStatus) />
</cfif>
<cfoutput>
<ul>
<cfloop from="1" to="#totalTweets#" index="tweet">
    <cfset status = application.objTweet.entify(arrStatus[tweet]) />      
    <span class="tweet_text">
    	<li id="custom-twitter-4_tweets">#arrStatus[tweet]['user']['name']#: #status#</li>
    </span>    
</cfloop>
</ul>
</cfoutput>

Open in new window


Found this code somewhere from stackoverflow, but exactly where, i lost the link

hat will make you working, any issues ping here again
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

886 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