Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Coldfusion code for twitter updated api v1.1

Posted on 2013-06-12
3
Medium Priority
?
1,274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

722 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