Bootstrap

Http请求API


        /// <summary>
        /// GET
        /// </summary>
        /// <param name="url"></param>
        /// <param name="token"></param>
        /// <param name="timespan"></param>
        /// <returns></returns>
        public static Tuple<Stream, string, string> HttpGet(string url,string token,string timespan)
        {
            HttpWebRequest myRequest = WebRequest.Create(url) as HttpWebRequest;
            myRequest.Method = "GET";
            myRequest.Timeout = 20 * 1000;


            WebHeaderCollection headers = new WebHeaderCollection();
            headers.Add("Token", token);
            headers.Add("Timespan", timespan);
            myRequest.UserAgent = null;
            myRequest.Headers = headers;

;