本文整理汇总了C#中GlobusTwitterLib.Authentication.oAuthTwitter.oAuthWebRequest方法的典型用法代码示例。如果您正苦于以下问题:C# oAuthTwitter.oAuthWebRequest方法的具体用法?C# oAuthTwitter.oAuthWebRequest怎么用?C# oAuthTwitter.oAuthWebRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobusTwitterLib.Authentication.oAuthTwitter
的用法示例。
在下文中一共展示了oAuthTwitter.oAuthWebRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FollowersStatus
/// <summary>
/// This Method Get All Followers Details of User
/// </summary>
/// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <param name="ScreenName">User Screen Name</param>
/// <returns></returns>
public XmlDocument FollowersStatus(oAuthTwitter oAuth, string ScreenName, string cursor)
{
string RequestUrl = Globals.FollowerStatusUrl + ScreenName + ".xml?cursor=" + cursor;
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, string.Empty);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例2: FriendsId
/// <summary>
/// This Method Will Get All Friends Id of User
/// </summary>
/// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <param name="ScreenName">ScreenName Of Whom You Want To Get FriendsId</param>
/// <returns>All Friends Id</returns>
public XmlDocument FriendsId(oAuthTwitter OAuth, string ScreenName)
{
string RequestUrl = Globals.FriendsIdUrl + ScreenName;
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET,RequestUrl,string.Empty);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例3: Rate_Limit_Status
//#region OAuth
///// <summary>
///// This Method Will Check That User is Authenticated Or Not Using OAUTH
///// </summary>
///// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
///// <returns>Return Xml Text With User Details</returns>
//public XmlDocument Verify_Credentials(oAuthTwitter OAuth)
//{
// string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.VerifyCredentialsUrl, String.Empty);
// xmlResult.Load(new StringReader(response));
// return xmlResult;
//}
/// <summary>
/// This method Will Check Rate Limit Of Account Using OAUTH
/// </summary>
/// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <returns>Return Xml Text With User Details</returns>
public XmlDocument Rate_Limit_Status(oAuthTwitter OAuth, SortedDictionary<string, string> strdic)
{
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.RateLimitStatusUrl, strdic);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例4: FollowAccount
public static bool FollowAccount(string AccessToken,string AccessTokenSecret ,string Screen_name, string user_id)
{
bool IsFollowed = false;
oAuthTwitter oauth = new oAuthTwitter();
oauth.AccessToken = AccessToken;
oauth.AccessTokenSecret = AccessTokenSecret;
oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
string RequestUrl = "https://api.twitter.com/1.1/friendships/create.json";
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
if (!string.IsNullOrEmpty(Screen_name))
{
strdic.Add("screen_name", Screen_name);
}
else if (!string.IsNullOrEmpty(user_id))
{
strdic.Add("user_id", user_id);
}
else
{
return false;
}
strdic.Add("follow", "true");
string response = oauth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, strdic);
if (!string.IsNullOrEmpty(response))
{
IsFollowed = true;
}
return IsFollowed;
}
示例5: SearchMethod
/// <summary>
/// This Method Will Get All Trends Of Twitter Using OAUTH
/// </summary>
/// <param name="User">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <returns>Json Text Of Trends</returns>
public XmlDocument SearchMethod(oAuthTwitter OAuth, string SearchKey, string pageindex)
{
TwitterWebRequest twtWebReq = new TwitterWebRequest();
string RequestUrl = Globals.SearchUrl + SearchKey + "&page=" + pageindex;
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl,string.Empty);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例6: Post_Statuses_DestroyById
/// <summary>
/// Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status. Returns the destroyed status if successful.
/// </summary>
/// <param name="oAuth"></param>
/// <param name="UserId"></param>
/// <returns></returns>
public JArray Post_Statuses_DestroyById(oAuthTwitter oAuth, string UserId)
{
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
string RequestUrl = Globals.StatusDestroyByIdUrl + UserId + ".json";
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, strdic);
if (!response.StartsWith("["))
response = "[" + response + "]";
return JArray.Parse(response);
}
示例7: FollowersCount
public int FollowersCount(oAuthTwitter oAuth, string screenname, SortedDictionary<string, string> strdic)
{
string RequestUrl = "https://api.twitter.com/1/users/lookup.xml?screen_name=" + screenname;
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, strdic);
xmlResult.Load(new StringReader(response));
TwitterUser twtUser = new TwitterUser();
XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");
int count = 0;
foreach (XmlNode xn in xmlNodeList)
{
XmlElement idElement = (XmlElement)xn;
count = Convert.ToInt32(idElement.GetElementsByTagName("followers_count")[0].InnerText);
}
return count;
}
示例8: Friendships_Destroy
/// <summary>
/// UnFollow Twitter User Using OAUTH
/// </summary>
/// <param name="twitterUser">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <param name="UserToFollow">ScreenName Of Whom You Want To UnFollow</param>
/// <returns>Returm Xml</returns>
public XmlDocument Friendships_Destroy(oAuthTwitter oAuth, int UserId)
{
string RequestUrl = Globals.UnFollowUrlById + UserId;
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, string.Empty);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例9: Get_Friendships_No_Retweets_Id
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Returns a collection of user_ids that the currently authenticated user does not want to receive retweets from.
/// </summary>
/// <param name="oAuth"></param>
/// <returns></returns>
public JArray Get_Friendships_No_Retweets_Id(oAuthTwitter oAuth)
{
string RequestUrl = Globals.GetFriendshipsNoRetweetsIdUrl;
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, strdic);
if (!response.StartsWith("["))
response = "[" + response + "]";
return JArray.Parse(response);
}
示例10: Get_Statuses_retweetersById
/// <summary>
/// Post a tweet with Image
/// </summary>
/// <param name="oAuth"></param>
/// <param name="UserId"></param>
/// <param name="postData"></param>
/// <returns></returns>
//public string Post_Statuses_Update_With_Media(oAuthTwitter oAuth, string UserId, string postData, string imageFile)
//{
// string RequestUrl = Globals.PostStatusUpdateWithMediaUrl;
// string response=oAuth.webRequestWithContentType(oAuth, imageFile, "multipart/form-data; boundary=", RequestUrl,postData);
// return response;
//}
#endregion
#region Get_Statuses_retweetersById
/// <summary>
/// Returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter.
/// </summary>
/// <param name="oAuth"></param>
/// <param name="UserId"></param>
/// <param name="postData"></param>
/// <returns></returns>
public JArray Get_Statuses_retweetersById(oAuthTwitter oAuth, string StatusId)
{
string RequestUrl = Globals.GetStatusesRetweetersByIdUrl;
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
strdic.Add("id", StatusId);
strdic.Add("count", "100");
strdic.Add("stringify_ids", "true");
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, strdic);
if (!response.StartsWith("["))
response = "[" + response + "]";
return JArray.Parse(response);
}
示例11: Verify_Credentials
/// <summary>
/// This Method Will Check That User is Authenticated Or Not Using OAUTH
/// </summary>
/// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <returns>Return Xml Text With User Details</returns>
public JArray Verify_Credentials(oAuthTwitter OAuth)
{
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.VerifyCredentialsUrl, strdic);
//xmlResult.Load(new StringReader(response));
if (!response.StartsWith("["))
response = "[" + response + "]";
return JArray.Parse(response);
}
示例12: Get_Search_Users
public string Get_Search_Users(oAuthTwitter oAuth, string SearchKeyword)
{
string RequestUrl = "https://api.twitter.com/1.1/users/search.json";
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
strdic.Add("q", SearchKeyword);
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, strdic);
if (!response.StartsWith("["))
response = "[" + response + "]";
return response;
}
示例13: getTwitterRetweets
//public Dictionary<string, int> getTwitterRetweetsList(string Id, string Accesstoken, int days)
//{
// JObject output = new JObject();
// try
// {
// SortedDictionary<string, string> requestParameters = new SortedDictionary<string, string>();
// requestParameters.Add("count", "100");
// //requestParameters.Add("screen_name", ScreenName);
// //requestParameters.Add("cursor", "-1");
// //Token URL
// var oauth_url = "https://api.twitter.com/1.1/statuses/retweets/" + Id + ".json";
// var headerFormat = "Bearer {0}";
// //var authHeader = string.Format(headerFormat, "AAAAAAAAAAAAAAAAAAAAAOZyVwAAAAAAgI0VcykgJ600le2YdR4uhKgjaMs%3D0MYOt4LpwCTAIi46HYWa85ZcJ81qi0D9sh8avr1Zwf7BDzgdHT");
// var authHeader = string.Format(headerFormat, "AAAAAAAAAAAAAAAAAAAAAOZyVwAAAAAAgI0VcykgJ600le2YdR4uhKgjaMs%3D0MYOt4LpwCTAIi46HYWa85ZcJ81qi0D9sh8avr1Zwf7BDzgdHT");
// var postBody = requestParameters.ToWebString();
// ServicePointManager.Expect100Continue = false;
// HttpWebRequest request = (HttpWebRequest)WebRequest.Create(oauth_url + "?"
// + requestParameters.ToWebString());
// request.Headers.Add("Authorization", authHeader);
// request.Method = "GET";
// request.Headers.Add("Accept-Encoding", "gzip");
// HttpWebResponse response = request.GetResponse() as HttpWebResponse;
// Stream responseStream = new GZipStream(response.GetResponseStream(), CompressionMode.Decompress);
// using (var reader = new StreamReader(responseStream))
// {
// JavaScriptSerializer js = new JavaScriptSerializer();
// var objText = reader.ReadToEnd();
// output = JObject.Parse(objText);
// }
// }
// catch (Exception e)
// {
// logger.Error(e.Message);
// }
// // return output.ToString();
// Dictionary<string, int> LikesByDay = new Dictionary<string, int>();
// // LikesByDay = getTwitterFollowers(outputface);
// return LikesByDay;
//}
public string getTwitterRetweets(string Accesstoken, string AccesstokenSecret, int days, string LastId)
{
oAuthTwitter oauth = new oAuthTwitter();
oauth.AccessToken = Accesstoken;
oauth.AccessTokenSecret = AccesstokenSecret;
oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
string RequestUrl = "https://api.twitter.com/1.1/statuses/retweets_of_me.json";
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
strdic.Add("count", "100");
if (!string.IsNullOrEmpty(LastId))
{
strdic.Add("max_id", LastId);
}
//strdic.Add("screen_name", ScreenName);
string response = oauth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, strdic);
return response;
}
示例14: ShowStatusByScreenName
/// <summary>
/// This Method Will Show User Statues Using OAUTH
/// </summary>
/// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <param name="ScreenName">Twitter UserName</param>
/// <returns>Return User Status Details</returns>
public XmlDocument ShowStatusByScreenName(oAuthTwitter oAuth, string ScreenName)
{
string RequestUrl = Globals.ShowStatusUrlByScreenName+ScreenName;
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, string.Empty);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例15: Get_Followers_List
/// <summary>
/// Returns a cursored collection of user objects for users following the specified user.
/// </summary>
/// <param name="oAuth"></param>
/// <param name="UserId"></param>
/// <returns></returns>
public JArray Get_Followers_List(oAuthTwitter oAuth)
{
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
string RequestUrl = Globals.GetFollowersListUrl;
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, strdic);
if (!response.StartsWith("["))
response = "[" + response + "]";
return JArray.Parse(response);
}