Пример #1
0
        public static void SendJSON(string msg)
        {
            try
            {
                if (msg.Length == 0)
                {
                    return;
                }
                var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://ws.skandiabot.com/api/v3/teams/887736t1gfgcpjjjg7qwmeoedc/channels/75hytsmqhpgnze6skwzyqzrszr/posts/create");
                httpWebRequest.ContentType                 = "application/json";
                httpWebRequest.Method                      = "POST";
                httpWebRequest.Headers["Cookie"]           = "mybb[lastvisit]=1491706122; mybb[lastactive]=1491706150; loginattempts=1; mybbuser=1092_mefHwMLHOFOHeyLatViKZjORQVPpl3BPo46lKvhFjQ8EdRFkbQ; mybb[cookielaw]=1; sid=0de93aebcf0e71c9072cdf597269a41a; _ga=GA1.2.1344386101.1491706124; MMAUTHTOKEN=1keeuod3qfys9n3jqgefz34onc";
                httpWebRequest.Headers["X-Requested-With"] = "XMLHttpRequest";
                var Publish = new SkandiaPublish(msg, "75hytsmqhpgnze6skwzyqzrszr", "hobmgpbc6bf3mcqf87ce61nnsh:" + currentTimeStamp(), "hobmgpbc6bf3mcqf87ce61nnsh", (long)currentTimeStamp());
                var data    = JsonSerialize(Publish);
                // httpWebRequest.ContentLength = data.Length;
                using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
                {
                    streamWriter.Write(data);

                    streamWriter.Flush();
                    streamWriter.Close();
                }
                Skandia.MessageLog("JSONRequest Sent !");
            }catch (WebException e)
            {
                Skandia.MessageLog("SendJSON ExceptionMessage: " + e.Message);
                Skandia.MessageLog("SendJSON InnerException: " + e.InnerException);
                Skandia.MessageLog("SendJSON SourceException: " + e.Source);
                Skandia.MessageLog("SendJSON StackTrace: " + e.StackTrace);
            }
        }
Пример #2
0
 public static string JsonSerialize(SkandiaPublish data)
 {
     return(JsonConvert.SerializeObject(data));
 }