예제 #1
0
파일: Function.cs 프로젝트: AlexAegwynn/PGY
        public string GetHtmlString_UTF8_Get_New(string cookiesStr, ref MurlMsg urlMsg)
        {
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(urlMsg.SubmitUrl);

            if (cookiesStr != "")
            {
                request.Headers[HttpRequestHeader.Cookie] = cookiesStr;
            }

            request.Method = "Get";
            //request.Host = "www.360doc.com";
            request.Host = "www.toutiao.com";
            //request.Referer = "http://www.360doc.com/index.html";
            request.Referer = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36";

            HttpWebResponse response     = (HttpWebResponse)request.GetResponse(); //执行请求,获取响应对象
            Stream          stream       = response.GetResponseStream();           //获取响应流
            StreamReader    sr           = new StreamReader(stream);               //创建流读取对象
            string          responseHTML = sr.ReadToEnd();                         //读取响应流

            urlMsg.HtmlStr = responseHTML;
            response.Close();            //关闭响应流
            //int strleght = output.Length;
            return(urlMsg.HtmlStr);
        }
예제 #2
0
파일: Function.cs 프로젝트: AlexAegwynn/PGY
        public bool GetHtmlString_Default_Get(string cookiesStr, ref MurlMsg urlMsg)
        {
            string htmlStr   = urlMsg.HtmlStr;
            string returnUrl = urlMsg.ReturnUrl;
            bool   isOK      = GetHtmlString_Default_Get_Base(urlMsg.SubmitUrl, cookiesStr, ref htmlStr, ref returnUrl);

            urlMsg.HtmlStr   = htmlStr;
            urlMsg.ReturnUrl = returnUrl;
            return(isOK);
        }
예제 #3
0
파일: Function.cs 프로젝트: AlexAegwynn/PGY
        public bool GetHtmlString_UTF8_Post_Base(string cookiesStr, IDictionary <string, string> parameters, ref MurlMsg urlMsg)
        {
            string htmlStr   = urlMsg.HtmlStr;
            string returnUrl = urlMsg.ReturnUrl;
            bool   isOK      = GetHtmlString_UTF8_Post_Base(urlMsg.SubmitUrl, cookiesStr, parameters, ref htmlStr, ref returnUrl);

            urlMsg.HtmlStr   = htmlStr;
            urlMsg.ReturnUrl = returnUrl;
            return(isOK);
        }