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;
            }

  • 相关阅读:
    1JavaScript的历史
    扯扯 require .js
    查看js 执行效率工具
    php 输入输出流
    词法分析096
    Python基础综合练习
    096
    大数据概述
    熟悉常用的Linux操作
    实验一、词法分析实验
  • 原文地址:https://www.cnblogs.com/jincieryi/p/9630054.html
Copyright © 2011-2022 走看看