Using pastebin API in VB .Net
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
精彩评论