发送消息给twitter

时间:2012-11-23 09:29:12

标签: c# c#-4.0 twitter

我想在twitter发布消息。

这是我目前使用的代码:

public void PostTweets(string userName, string password, string updateMessage)
{
   using (WebClient wc = new WebClient())
   {
      wc.Credentials = new NetworkCredential(userName, password);
      ServicePointManager.Expect100Continue = false;

      byte[] updateMessageBytes = System.Text.Encoding.UTF8.GetBytes("status=" + updateMessage); //Use UTF8 to get it properly encoded if you use characters like ç ã etc...

      wc.UploadData("https://dev.twitter.com/docs/api/1/post/statuse/update",updateMessageBytes);
   }
}

它给了我一个错误:

The remote server returned an error: (401) Unauthorized.

0 个答案:

没有答案