Solved

Coldfusion code for twitter updated api v1.1

Posted on 2013-06-12
3
1,129 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 15

Expert Comment

by:myselfrandhawa
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 15

Accepted Solution

by:
myselfrandhawa earned 500 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ColdFusion Report Builder 7 56
Coldfusion speed up 4 69
<cffile cannot delete a file 4 40
Cold Fusion Migration 4.5 --> 10 !! 4 42
The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now