8/16/11

using bitly to shorten links classic .asp VBScript

A very easy script to shorten links using the bitly api.




Function bitlyThis(longURL)
apikey = "12345"
url = "http://api.bitly.com/v3/shorten?login=logsitall&apiKey=" & apikey & "&longUrl=" & longURL & "&format=txt"

set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""

bitlyThis = xmlhttp.responseText
set xmlhttp = nothing

END FUNCTION


longURL = "http://www.wikipedia.com"

response.write bitlyThis(longURL)


1 comment:

  1. Hi, this dont work, it says the api key is invalid but its not.

    ReplyDelete