Solved

Coldfusion code for twitter updated api v1.1

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
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 antispam), the admini…

738 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