zoukankan      html  css  js  c++  java
  • 获取http请求

        public  string GetUrlDate(string url, string method, string content)
        {
            string outstring = "";
            try
            {
                System.Net.HttpWebRequest myRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url);
                myRequest.Method = method;
                myRequest.KeepAlive = false;
                myRequest.ContentType = "application/x-www-form-urlencoded";

                System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                string postData = content;
                byte[] data = encoding.GetBytes(postData);
                myRequest.ContentLength = data.Length;
                System.IO.Stream newStream = myRequest.GetRequestStream();
                newStream.Write(data, 0, data.Length);
                newStream.Close();


                using (System.Net.HttpWebResponse myResponse = (System.Net.HttpWebResponse)myRequest.GetResponse())
                {

                    System.IO.StreamReader sr = new System.IO.StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
                    outstring= sr.ReadToEnd();
                }
            }
            catch (Exception ex)
            {
                IExceptionPublisher Publisher = new ExceptionPublisher();
                Publisher.Publish(ex, null, null);
                outstring= "";
            }
            return outstring;
        }

  • 相关阅读:
    windows本地提权——2003笔记
    Windows与linux添加用户命令
    反弹shell集锦
    提权-特权升级
    常见端口
    git泄露利用脚本
    Thinkphp5命令执行利用
    Thinkphp2.1漏洞利用
    打ms15-034补丁出现“此更新 不适用于您的计算机”
    Hyda爆破
  • 原文地址:https://www.cnblogs.com/linzheng/p/1814162.html
Copyright © 2011-2022 走看看