using
System.Data;using
System.Configuration;using
System.Collections;using
System.Web;using
System.Web.Security;using
System.Web.UI;using
System.Web.UI.WebControls;using
System.Web.UI.WebControls.WebParts;using
System.Web.UI.HtmlControls;using
oAuthExample;using
System.Threading;public
partial class Default6 : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
string url = ""; string xml = ""; oAuthTwitter oAuth = new oAuthTwitter(); if (Request["oauth_token"] == null){
oAuth.CallBackUrl =
"http://localhost/twitterpost/default6.aspx";Response.Redirect(oAuth.AuthorizationLinkGet());
}
else{
Response.Write(oAuth.TokenSecret.Length);
if (oAuth.TokenSecret.Length <= 0){
oAuth.AccessTokenGet(Request[
"oauth_token"], Request["oauth_verifier"]);}
if (oAuth.TokenSecret.Length > 0){
url =
"http://twitter.com/account/verify_credentials.xml";xml = oAuth.oAuthWebRequest(
oAuthTwitter.Method.GET, url, String.Empty);apiResponse.InnerHtml = Server.HtmlEncode(xml);
url =
"http://twitter.com/statuses/update.xml";xml = oAuth.oAuthWebRequest(
oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("#Cybermonday deals on Football Products http://visli.com/mainsearch/Football/All/1.aspx"));apiResponse.InnerHtml = Server.HtmlEncode(xml);
Response.Write(
"time 1 =>" +DateTime.Now.ToLongTimeString());System.Threading.
Thread.Sleep(120000);Response.Write(
"<br>time 2 =>" + DateTime.Now.ToLongTimeString()); // url = "http://twitter.com/statuses/update.xml"; Trousersxml = oAuth.oAuthWebRequest(
oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("#Cybermonday deals on basketball... http://visli.com/mainsearch/basketball/All/1.aspx"));apiResponse.InnerHtml = Server.HtmlEncode(xml);
}
}
}
}
1 comment:
check this out for posting messages from database to twitter..in a time interval...
http://mytechnicalcorner.blogspot.com/2010/12/twitter-new-api-c-post-message-from.html
Post a Comment