public void ReTweet(ref Globussoft.GlobusHttpHelper globusHttpHelper, string pgSrc, string postAuthenticityToken, string tweetID, string tweetMessage, out string status) { try { //Post Tweet To Account //ReTweet 0 string strpostAuthenticityToken = string.Empty; string get_twitter_first = globusHttpHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/"), IPAddress, IPPort, IPUsername, IPpassword, string.Empty, string.Empty); if (!string.IsNullOrEmpty(get_twitter_first) && !string.IsNullOrWhiteSpace(get_twitter_first)) { // strpostAuthenticityToken = PostAuthenticityToken(get_twitter_first, "postAuthenticityToken"); } string TweetId = tweetID;// "197682704844734464"; string ReTweetData = "post_authenticity_token=" + postAuthenticityToken; string ReTweetPostUrl = "https://api.twitter.com/1/statuses/retweet/" + TweetId + ".json"; string res_Post_Retweet = globusHttpHelper.postFormData(new Uri(ReTweetPostUrl), ReTweetData, "https://api.twitter.com/receiver.html", postAuthenticityToken, "XMLHttpRequest", "true", ""); status = "posted"; } catch (Exception ex) { status = "not posted"; //Log("Method>>ReTweet --- class>>Tweeter.cs : ReTweet Exception " + ex.Message); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> Tweeter() - ReTweet --> " + ex.Message, Globals.Path_TweetingErroLog); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> Tweeter() - ReTweet --> " + ex.Message, Globals.Path_TwtErrorLogs); } }
public void Tweet(ref Globussoft.GlobusHttpHelper globusHttpHelper, string pgSrc, string postAuthenticityToken, string tweetMessage, out string status) { try { //string abc = tweetMessage.Replace("�", " "); //Post Tweet To Account string strpostAuthenticityToken = string.Empty; string get_twitter_first = globusHttpHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/"), IPAddress, IPPort, IPUsername, IPpassword, string.Empty, string.Empty); if (!string.IsNullOrEmpty(get_twitter_first) && !string.IsNullOrWhiteSpace(get_twitter_first)) { strpostAuthenticityToken = PostAuthenticityToken(get_twitter_first, "postAuthenticityToken"); } if (!string.IsNullOrEmpty(tweetMessage) && !string.IsNullOrWhiteSpace(tweetMessage)) { if (tweetMessage.Length > 140) { int index = tweetMessage.Length - 140; tweetMessage = tweetMessage.Remove(tweetMessage.Length - index); string TweetData = "include_entities=true&status=" + HttpUtility.UrlEncode(tweetMessage) + "&post_authenticity_token=" + strpostAuthenticityToken; string res_PostTweet = globusHttpHelper.postFormData(new Uri("https://api.twitter.com/1/statuses/update.json"), TweetData, "https://api.twitter.com/receiver.html", strpostAuthenticityToken, "XMLHttpRequest", "true", ""); status = "posted"; } else { string TweetData = "include_entities=true&status=" + HttpUtility.UrlEncode(tweetMessage) + "&post_authenticity_token=" + strpostAuthenticityToken; string res_PostTweet = globusHttpHelper.postFormData(new Uri("https://api.twitter.com/1/statuses/update.json"), TweetData, "https://api.twitter.com/receiver.html", strpostAuthenticityToken, "XMLHttpRequest", "true", ""); status = "posted"; } } else { status = "Tweet Message Is Empty !"; } } catch (Exception ex) { status = "not posted"; //Log("Method>>Tweet --- class>>Tweeter.cs : Tweet Exception " + ex.Message); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> Tweeter() -- Tweet() --> " + ex.Message, Globals.Path_FollowerErroLog); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> Tweeter() -- Tweet() --> " + ex.Message, Globals.Path_TwtErrorLogs); } }
public void Reply(ref Globussoft.GlobusHttpHelper globusHttpHelper, string postAuthenticityToken, string tweetID, string tweetUserName, string screenName, string tweetMessage, string userName) { try { if (userName == UserName) { string strpostAuthenticityToken = string.Empty; string get_twitter_first = globusHttpHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/"), IPAddress, IPPort, IPUsername, IPpassword, string.Empty, string.Empty); if (!string.IsNullOrEmpty(get_twitter_first) && !string.IsNullOrWhiteSpace(get_twitter_first)) { strpostAuthenticityToken = PostAuthenticityToken(get_twitter_first, "postAuthenticityToken"); } //Reply //string TweetId = tweetID;// "197682704844734464"; //string ReTweetData = "post_authenticity_token=" + postAuthenticityToken; //string ReTweetPostUrl = "https://api.twitter.com/1/statuses/retweet/" + TweetId + ".json"; //string a6 = globusHttpHelper.postFormData(new Uri(ReTweetPostUrl), ReTweetData, "https://api.twitter.com/receiver.html", postAuthenticityToken, "XMLHttpRequest", "true", ""); if (!string.IsNullOrEmpty(tweetMessage) && !string.IsNullOrWhiteSpace(tweetMessage)) { string TweetId = tweetID; //"197551187803906048"; string ReplyData = "in_reply_to_status_id=" + TweetId + "&include_entities=true&status=" + screenName + " " + tweetUserName + " " + HttpUtility.UrlEncode(tweetMessage) + "&post_authenticity_token=" + strpostAuthenticityToken; //"in_reply_to_status_id=" + TweetId + "&include_entities=true&status=%40" + "screenname to reply to" + "+" + tweetMessage + "&post_authenticity_token=" + postAuthenticityToken; string res_Post_Reply = globusHttpHelper.postFormData(new Uri("https://api.twitter.com/1/statuses/update.json"), ReplyData, "https://api.twitter.com/receiver.html", postAuthenticityToken, "XMLHttpRequest", "true", ""); //status = "posted"; Log("[ " + DateTime.Now + " ] => [ Message Posted Sucessfully Where Status Id = " + tweetID + " With User Name : " + userName + " ]"); obj_clsDB_ReplyInterface.DeleteRecordsAfterReplyFromtb_ReplyCampaign(StringEncoderDecoder.Encode(tweetID), StringEncoderDecoder.Encode(userName)); } else { Log("[ " + DateTime.Now + " ] => [ Message Couldn't Post Sucessfully .Since Message Is Empty Where Status Id = " + tweetID + " With User Name : " + userName + " ]"); } } } catch (Exception ex) { //status = "not posted"; Log("[ " + DateTime.Now + " ] => [ Method>> Reply --- class>> Tweeter.cs : Reply Exception With User Name : " + UserName + " " + ex.Message + " ]"); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> Reply() --> " + ex.Message, Globals.Path_TweetingErroLog); Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> Reply() --> " + ex.Message, Globals.Path_TwtErrorLogs); } }