zoukankan      html  css  js  c++  java
  • 钉钉机

     string url = "https://oapi.dingtalk.com/robot/send?access_token=847bc045c802beaba749aec846f91901730f3b185ca";

    var bl = new { msgtype = "text", text = new { content = "不一样的烟火" } };
                string cs = new JavaScriptSerializer().Serialize(bl);
                string jg = HttpPost(url, cs);
                MessageBox.Show(jg);

      private string HttpPost(string Url, string postDataStr)
            {

                string strURL = Url;
                System.Net.HttpWebRequest request;
                request = (System.Net.HttpWebRequest)WebRequest.Create(strURL);
                request.Method = "POST";
                request.ContentType = "application/json;charset=UTF-8";
                string paraUrlCoded = postDataStr;
                byte[] payload;
                payload = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
                request.ContentLength = payload.Length;
                Stream writer = request.GetRequestStream();
                writer.Write(payload, 0, payload.Length);
                writer.Close();
                System.Net.HttpWebResponse response;
                response = (System.Net.HttpWebResponse)request.GetResponse();
                System.IO.Stream s;
                s = response.GetResponseStream();
                string StrDate = "";
                string strValue = "";
                StreamReader Reader = new StreamReader(s, Encoding.UTF8);
                while ((StrDate = Reader.ReadLine()) != null)
                {
                    strValue += StrDate + " ";
                }
                return strValue;


            }

  • 相关阅读:
    HTB靶场记录之Cronos
    大家好,我是菜菜子,Can’t RCE安全团队队长
    Linux进阶教程丨第11章:归档和传输文件
    Java自动化审计(上篇)
    HTB靶场记录之Arctic
    Linux进阶教程丨第14章:管理基本存储和管理逻辑卷
    博客园文章自定义的图片放大功能失效修复
    caffeine配置及注意事项
    CR和LF
    Capsulebased Object Tracking with Natural Language Specification AHU
  • 原文地址:https://www.cnblogs.com/xiangxiong/p/7909723.html
Copyright © 2011-2022 走看看