zoukankan      html  css  js  c++  java
  • C# http请求

            /// <summary>
            /// GET方式发送得结果
            /// </summary>
            /// <param name="url">请求的url</param>
            public static string DoGetRequestSendData(string url)
            {
                HttpWebRequest hwRequest = null;
                HttpWebResponse hwResponse = null;

                string strResult = string.Empty;
                try
                {
                    hwRequest = (System.Net.HttpWebRequest)WebRequest.Create(url);
                    //hwRequest.Timeout = 30000;
                    hwRequest.Method = "GET";
                    hwRequest.ContentType = "application/x-www-form-urlencoded";
                }
                catch (System.Exception err)
                {

                }
                try
                {
                    hwResponse = (HttpWebResponse)hwRequest.GetResponse();
                    StreamReader srReader = new StreamReader(hwResponse.GetResponseStream(), Encoding.ASCII);
                    strResult = srReader.ReadToEnd();
                    srReader.Close();
                    hwResponse.Close();
                }
                catch (System.Exception err)
                {
                }
                return strResult;
            }

  • 相关阅读:
    url末尾的斜杠作用
    awk 工具可以很灵活地对文本进行处理,这里的 awk '{print $2}'是指第二列的内容,是运行的程序 ID。 杀死指定进程
    nil和空切片
    WaitGroup源码设计,
    2
    t
    Go内置的定时器
    分布式定时器
    1 2 交换
    order by 1 DESC 2 desc
  • 原文地址:https://www.cnblogs.com/jincieryi/p/9630054.html
Copyright © 2011-2022 走看看