您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
C#调用新浪微博API
WebRequest wq = WebRequest.Create(this.address); HttpWebRequest hq = wq as HttpWebRequest; string username = "keguangqiang@163.com"; string password = "3216731ks"; string appkey = "5786724301"; System.Net.CredentialCache cache = new CredentialCache(); cache.Add(new Uri(this.address), "Basic", new NetworkCredential(username, password)); hq.Credentials = cache; hq.Headers.Add("Authorization","Basic " +Convert.ToBase64String(new System.Text.ASCIIEncoding().GetBytes(username+":"+password))); System.Net.WebResponse webresponse = hq.GetResponse(); System.IO.Stream receiveStream = webresponse.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(receiveStream, System.Text.Encoding.UTF8); string json = reader.ReadToEnd();
以上代码实例很简单,大家可以本地测试下,感谢你的阅读和对亿速云的支持。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。