H开发者_Go百科ow do I reach the bit.ly
API with VB.net 2010—is it even possible? How?
I was interested myself to see how it works, this might get you started:
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
The API documentation can be found here: http://code.google.com/p/bitly-api/wiki/ApiDocumentation
I found 2 examples where they use bit.ly to shorten url's. Is this what you're looking for?
- http://www.emadibrahim.com/2009/05/07/shortening-urls-with-bitlys-api-in-net
- http://www.fryan0911.com/2009/09/how-to-use-bitly-api-to-shorten-url-in.html
精彩评论