Tinyurl API and Classic ASP

April 8, 2009

If you wanted to link to the tinyurl.com api in order to create tinyurl’s with ASP then here is the code I am successfully using with my ASP twitter updater.

Function GetTinyURL(url)

‘set the url
url=”http://tinyurl.com/api-create.php?url=” & url

Set GetConnection = CreateObject(“Microsoft.XMLHTTP”)
GetConnection.Open “get”, url, False
GetConnection.Send
ResponsePage = GetConnection.responseText
Set GetConnection = Nothing

GetTinyURL=ResponsePage

End Function

Response.write GetTinyURL(“https://www.craig-edmonds.com”)

Thats all there is too it!