Example #1
0
 /*最新评论*/
 public string comments_timeline(string userid, string passwd, string format)
 {
     oAuthSina _oauth = new oAuthSina();
     if (oAuth(userid, passwd, _oauth))
     {
         string url = "http://api.t.sina.com.cn/statuses/comments_timeline." + format;
         return _oauth.oAuthWebRequest(oAuthSina.Method.GET, url, String.Empty);
     }
     else
         return null;
 }
Example #2
0
 /*批量获取一组微博的评论数及转发数*/
 public string counts(string userid, string passwd, string format, string ids)
 {
     oAuthSina _oauth = new oAuthSina();
     if (oAuth(userid, passwd, _oauth))
     {
         string url = "http://api.t.sina.com.cn/statuses/counts." + format + "?ids=" + ids;
         return _oauth.oAuthWebRequest(oAuthSina.Method.GET, url, String.Empty);
     }
     else
         return null;
 }
Example #3
0
 /**********************************************************************************************
  *************************************微博访问接口*********************************************
  **********************************************************************************************
  **********************************************************************************************/
 /*获取单条ID的微博信息*/
 public string statuses_show(string userid, string passwd, string format, string id)
 {
     oAuthSina _oauth = new oAuthSina();
     if (oAuth(userid, passwd, _oauth))
     {
         string url = "http://api.t.sina.com.cn/statuses/show/" + id + "." + format;
         return _oauth.oAuthWebRequest(oAuthSina.Method.GET, url, String.Empty);
     }
     else
         return null;
 }
Example #4
0
 /*发布一条微博信息*/
 public string statuses_update(string userid, string passwd, string format, string status)
 {
     oAuthSina _oauth = new oAuthSina();
     if (oAuth(userid, passwd, _oauth))
     {
         string url = "http://api.t.sina.com.cn/statuses/update." + format + "?";
         return _oauth.oAuthWebRequest(oAuthSina.Method.POST, url, "status=" + HttpUtility.UrlEncode(status));
     }
     else
         return null;
 }
Example #5
0
 public bool oAuth(string userid, string passwd,oAuthSina _oauth)
 {
     try
     {
         string authLink = _oauth.AuthorizationSinaGet();
         authLink += "&userId=" + userid + "&passwd=" + passwd + "&action=submit&oauth_callback=none";
         string html = _oauth.WebRequest(oAuthSina.Method.POST, authLink, null);
         string pin = ParseHtml(html);
         _oauth.Verifier = pin;
         _oauth.AccessTokenGet(_oauth.Token);
         return true;
     }
     catch(Exception ex)
     {
         return false;
     }
 }