Update Twitter Status with Classic ASP (VBScript)
Posted on 14.05.09 11:49:04 by Ariel G. Saputra in Classic ASP, Tutorials
I have several websites built with Classic ASP (am I insane? hell no, I love Classic ASP), and I have using twitter for months, as I seen twitter is getting popular each day, then I want to update the twitter account (associated with each websites) directly from the Classic ASP application, It is quite simple, by using Twitter API and Classic ASP XMLHTTP object.
Classic ASP Twitter Update Function
function asp_twitter_update(strMsg,strUser,strPass)
dim oXml,strFlickrUrl
strFlickrUrl = "http://twitter.com/statuses/update.xml"
set oXml = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
oXml.Open "POST", strFlickrUrl, false, strUser, strPass
oXml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXml.Send "status=" & server.URLencode(strMsg)
asp_twitter_update = oXml.responseText
Set oXml = nothing
end function
Update Twitter Status
Dim xmlStatuses,strMsg strMsg = "Hello twitter, send with Classic ASP" xmlStatuses = asp_twitter_update(strMsg,"username","password") Response.Write(xmlStatuses)
Twitter API + TinyURL API + Classic ASP
Let’s use our prior Classic ASP TinyURL function to shorten the content permalink and send it to twitter
Dim xmlStatuses,strTinyUrl,strMsg
strTinyUrl = asp_short_url("http://asp.web.id/get-flickr-photos-with-classic-asp-flickr-api.html")
strMsg = "Send from classic ASP with tiny url "&strTinyUrl&" happy classic asp coding"
xmlStatuses = asp_twitter_update(strMsg,"username","password")
Response.Write(xmlStatuses)
Author: Ariel G. Saputra
6 Comments For This Post
2 Trackbacks For This Post
-
15.05.09 03:37:22 at 03:37
Short URL with Classic ASP | ASP Blog Says:
[...] have more spare time in back couple days and I use it to play a bit with Classic ASP, flickr and twitter for a reason, but then pop out an idea to create a very simple library tom implement Twitter API in [...]
-
17.05.09 20:21:21 at 20:21
Update Twitter using Classic ASP (VBScript) Says:
[...] tutorial to update twitter status via twitter API and Classic ASP (VBScript) and directly shortenize url using TinyURL service, uses COM Object Microsoft XMLHTTP. Share this [...]



art
08/08/09 05:22
I can’t get it to update my Twitter account? it runs, no errors, just nothing happens, I just created the account a few minutes ago?
Any Ideas
Lil
06/03/10 14:14
Thank you for this code. I have used it to update my site’s (http://qhtimes.com) Twitter status with an announcement each time someone submits a new classified ad. I use your TinyURL code to create a shortcut url to the ad for Twitter on the fly. Very handy!
Lil
24/03/10 00:29
Do you have an Oauth solution that does the same things?
Lambright
18/04/10 00:50
Ariel, great work. I love classic ASP also.
Victor Saly
29/04/10 20:18
Thanks for sharing your functions, Now I’m able to update the twitter status with my CMS system every time that I have a new article published….
Lil
06/05/10 01:04
For those who may be looking, Scott Desapio has a Classic ASP Oauth library for Twitter at http://scottdesapio.com/