我正在尝试在网站上实现Twitter发布。当用户发布提醒并且他们勾选“提交给Twitter”时,我想将该方框的内容(140个字符)发送到相关的Twitter帐户。所以我做了以下事情:
每次我尝试提交时,我都会收到“无法通过OAuth验证”错误。我试图一次性做到这一点,所以我不是从twitter抓取令牌,而是在我的请求中填写oauth_token和oauth_token_secret,但仍然没有。有没有人在经典ASP中做过类似的事情?
代码:
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