码迷,mamicode.com
首页 > Windows程序 > 详细

C#调用新浪微博API

时间:2019-11-11 13:10:01      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:username   end   string   uri   har   jpg   enc   asc   receives   

            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();

  技术图片

C#调用新浪微博API

标签:username   end   string   uri   har   jpg   enc   asc   receives   

原文地址:https://www.cnblogs.com/keguangqiang/p/3315210.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!