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)


3 comments:

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

    ReplyDelete
  2. Primarily, I'm talking about Twitter here which only allows you 140 characters in a tweet. If you've got a long, long URL... how are you going to say anything about it to get people to click and look? Just sending the link is NOT going to get you views. bitly

    ReplyDelete
  3. I love this blog!! The flash up the top is awesome!!
    Shortener

    ReplyDelete