2
我有一個小問題,我剛剛從公共Pastebin API更改爲新的API。我得到一個無效的API錯誤:錯誤的API請求,無效api_option在VB .Net中使用pastebin API
這裏是我的代碼:
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.GetString(rd)
TextBox6.Text = r
Return r
任何人都可以幫我嗎?
他們說的API頁面上使用UTF-8編碼,所以我想,它還是老樣子不工作。舊代碼:System.Text.Encoding.ASCII.GetBytes新代碼:System.Text.Encoding.UTF8.GetBytes – user967587