2011-09-27 75 views
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 

任何人都可以帮我吗?

+0

他们说的API页面上使用UTF-8编码,所以我想,它还是老样子不工作。旧代码:System.Text.Encoding.ASCII.GetBytes新代码:System.Text.Encoding.UTF8.GetBytes – user967587

回答