public static String calltwitterapi(string screenname, string viewdata)
        {
            StringBuilder            dt   = new StringBuilder();
            TwitAuthenticateResponse auth = new TwitAuthenticateResponse();

            twitAuth(ref auth);
            LoadGeturl("@Longxone", auth);
            return("");
        }
        public static void twitAuth(ref TwitAuthenticateResponse twitAuthResponse)
        {
            var oAuthConsumerKey    = "ZypQZbZhdSTV3DitjNH5jP608";
            var oAuthConsumerSecret = "dz6iIMjOyCXU1sxOKPWjfmN7DUa8FnhpJ6UnpXLgbEfxLYGM1L";
            var oAuthUrl            = "https://api.twitter.com/oauth2/token";

            // Do the Authenticate
            var authHeaderFormat = "Basic {0}";

            var authHeader = string.Format(authHeaderFormat, Convert.ToBase64String(Encoding.UTF8.GetBytes(Uri.EscapeDataString(oAuthConsumerKey) + ":" +
                                                                                                           Uri.EscapeDataString((oAuthConsumerSecret)))));

            var postBody = "grant_type=client_credentials";

            HttpWebRequest authRequest = (HttpWebRequest)WebRequest.Create(oAuthUrl);

            authRequest.Headers.Add("Authorization", authHeader);
            authRequest.Method                 = "POST";
            authRequest.ContentType            = "application/x-www-form-urlencoded;charset=UTF-8";
            authRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

            using (Stream stream = authRequest.GetRequestStream())
            {
                byte[] content = ASCIIEncoding.ASCII.GetBytes(postBody);
                stream.Write(content, 0, content.Length);
            }

            authRequest.Headers.Add("Accept-Encoding", "gzip");
            var         objectText   = "";
            WebResponse authResponse = authRequest.GetResponse();

            using (authResponse)
            {
                using (var reader = new StreamReader(authResponse.GetResponseStream()))
                {
                    //JavaScriptSerializer js = new JavaScriptSerializer();
                    objectText = reader.ReadToEnd();
                    //twitAuthResponse = JsonConvert.DeserializeObject<TwitAuthenticateResponse>(objectText);
                }
            }
            //JavaScriptSerializer jss = new JavaScriptSerializer();
            //jss.RegisterConverters(new JavaScriptConverter[] { new DynamicJsonConverter() });
            //dynamic batch = jss.Deserialize(objectText, typeof(object)) as dynamic;
            //twitAuthResponse.access_token = batch.Dictionary["access_token"].ToString();
            //twitAuthResponse.access_token = batch.Dictionary["token_type"].ToString();
            twitAuthResponse.access_token = "AAAAAAAAAAAAAAAAAAAAAGJCXgAAAAAAPifZ009iZEL3cbdwidaAMCUgulQ%3DS9sqfh73u20uUl0AU4RkXWq6z64VKwr6bLSyz3NTOwpIKtZG8h";
            twitAuthResponse.access_token = "bearer";
        }
        public static string LoadGeturl(string screenname, TwitAuthenticateResponse twitAuthResponse)
        {
            //var screenname = "@Longxone";
            //var screenname = "@wood206";
            //var screenname = "@123123addonl";
            var timelineFormat = "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name={0}&include_rts=1&exclude_replies=1&count=5";
            var timelineUrl    = string.Format(timelineFormat, screenname);

            try
            {
                HttpWebRequest timeLineRequest      = (HttpWebRequest)WebRequest.Create(timelineUrl);
                var            timelineHeaderFormat = "{0} {1}";

                timeLineRequest.Headers.Add("Authorization", string.Format(timelineHeaderFormat, twitAuthResponse.token_type, twitAuthResponse.access_token));
                timeLineRequest.Method = "Get";
                WebResponse timeLineResponse = timeLineRequest.GetResponse();
                var         timeLineJson     = string.Empty;
                using (timeLineResponse)
                {
                    using (var reader = new StreamReader(timeLineResponse.GetResponseStream()))
                    {
                        timeLineJson = reader.ReadToEnd();
                    }
                }
                JavaScriptSerializer jss = new JavaScriptSerializer();
                jss.RegisterConverters(new JavaScriptConverter[] { new DynamicJsonConverter() });
                dynamic batch = jss.Deserialize(timeLineJson, typeof(object)) as dynamic;
                //return populatedata(batch, timeLineJson);

                return("");
                //twitAuthResponse.access_token = batch.Dictionary["access_token"].ToString();
                //twitAuthResponse.access_token = batch.Dictionary["token_type"].ToString();
            }
            catch (Exception e)
            {
                return(null);
            }
        }