Solved

Coldfusion code for twitter updated api v1.1

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
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…

626 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