开发者

Using pastebin API in VB .Net

开发者 https://www.devze.com 2023-04-09 07:40 出处:网络
I have a small problem, I\'ve just changed from the public Pastebin API to the new API. I get an invalid api error: Bad API request, invalid api_option

I have a small problem, I've just changed from the public Pastebin API to the new API. I get an invalid api error: Bad API request, invalid api_option

Here is my code:

Dim Exposure As Integer = 0
        System.Net.ServicePointManager.Expect100Continue = False
        If ComboBox1.Text = "Public" Then
            Exposure = 0
        Else
            Exposure = 1
        End If
        Dim fi As String = "?api_paste_private=" & Exposure & "&api_paste_format=" & ComboBox2.Text & "&api_paste_expire_date=" & ComboBox3.Text & "&api_dev_key=CENSORED" & "&api_paste_code=" & code
        Dim w As New System.Net.WebClient()
        w.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
        Dim pd As Byte() = System.Text.Encoding.ASCII.GetBytes(fi)
        Dim rd As Byte() = w.UploadData("http://pastebin.com/api/api_post.php", "POST", pd)
        Dim r As String = System.Text.Encoding.ASCII开发者_JS百科.GetString(rd)
        TextBox6.Text = r
        Return r

Can anyone please help me?


You must add api_option=paste to your request, as seen here: http://pastebin.com/api#2

0

精彩评论

暂无评论...
验证码 换一张
取 消