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

发布于 2024-10-07 15:12:13 字数 60 浏览 0 评论 0原文

如何使用 VB.net 2010 访问 bit.ly API——这可能吗?如何?

How do I reach the bit.ly API with VB.net 2010—is it even possible? How?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恰似旧人归 2024-10-14 15:12:13

我自己很想看看它是如何工作的,这可能会让你开始:

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文