Submitting to Twitter with Classic ASP

微笑、不失礼 提交于 2020-01-03 01:48:25

问题


I am trying to implement twitter posting on a website. when a user posts an alert and they check off "submit to twitter" I want to send the contents of the box (140 chars of it) to the associated twitter account. So I've done the following:

  • Registered a new app in twitter
  • Gotten all of my tokens/keys
  • Set up the following library: http://scottdesapio.com
  • Changed all of the parameters per the instructions

Every time I try to submit, though, I'm getting an "Could not authenticate with OAuth" error. I'm trying to do this all in one go, so I'm not grabbing the token from twitter but filling in both the oauth_token and the oauth_token_secret in my request, but still nothing. Has anyone had success with doing something like this in classic ASP?

Code:

Dim objOAuth : Set objOAuth = New cLibOAuth
objOAuth.ConsumerKey = twitter_consumer_key
objOAuth.ConsumerSecret = twitter_consumer_secret
objOAuth.EndPoint = "http://twitter.com/statuses/update.json"
objOAuth.Host = "api.twitter.com"
objOAuth.RequestMethod = "POST"
objOAuth.UserAgent = "Alert System Updater" 

objOAuth.Parameters.Add "oauth_token", twitter_oauth_token
objOAuth.Parameters.Add "oauth_token_secret", twitter_oauth_secret
objOAuth.Parameters.Add "status", tstatus
objOAuth.Send()

Dim strResponseText : strResponseText = objOAuth.ResponseText
Dim strErrorCode : strErrorCode = objOAuth.ErrorCode

If Not IsNull(strErrorCode) Then
    Response.Status = RESPONSE_STATUS_500
    Response.Write strErrorCode
Else
    Response.ContentType = "text/html"
    Response.CharSet = "utf-8"
    Response.Write strResponseText
End If

来源:https://stackoverflow.com/questions/15905921/submitting-to-twitter-with-classic-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!