是否可以使用VB.net调用bit.ly API?

时间:2010-12-13 08:48:29

标签: vb.net vb.net-2010 bit.ly

如何使用VB.net 2010访问bit.ly API - 是否可能?怎么样?

2 个答案:

答案 0 :(得分:4)

我很感兴趣,看看它是如何工作的,这可能会让你开始:

Option Infer On

Imports System.Net
Imports System.Web

Module Module1
    Sub Main()
        Dim wc = New WebClient()
        Dim login = "your_login"
        Dim apiKey = "your_apikey"
        Dim longUrl = HttpUtility.UrlEncode("http://stackoverflow.com/questions/4427104/vb-is-there-any-possibility-to-call-the-bit-ly-api")
        Dim request = String.Format("http://api.bit.ly/v3/shorten?login={0}&apiKey={1}&longUrl={2}&format=txt", login, apiKey, longUrl)
        Dim result = wc.DownloadString(request)
    End Sub

End Module

可以在此处找到API文档:http://code.google.com/p/bitly-api/wiki/ApiDocumentation

答案 1 :(得分:1)