Ejemplo n.º 1
0
        public void LoadPage()
        {
            MyLittleRequest     mlr = mlr_thispage;
            HttpResponseMessage res = mlr.MakeGetRequestAsync(this.base_url).Result;

            state = "loaded";
            string content_str = res.Content.ReadAsStringAsync().Result;

            content_raw_string   = content_str;
            doc_css              = new CQ(content_str);
            response_headers     = res.Headers;
            this.request_headers = mlr.client.DefaultRequestHeaders;
        }
Ejemplo n.º 2
0
        public WebPage2(string baseurl)
        {
            Regex rx = new Regex(@"^https?://.*$");
            Match m  = rx.Match(baseurl);

            if (!m.Success)
            {
                throw new IncorrectURL();
            }

            base_url = baseurl;
            // Instanciate request
            mlr_thispage = new MyLittleRequest(base_url);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="baseurl"></param>
        /// <param name="cookies"></param>
        public WebPage(string baseurl)
        {
            Regex rx = new Regex(@"^https?://.*$");
            Match m  = rx.Match(baseurl);

            if (!m.Success)
            {
                throw new IncorrectURL();
            }

            base_url     = baseurl;
            cookie_pot   = new CookieContainer();
            mlr_thispage = new MyLittleRequest(base_url);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Make a GET request to the base url.
        /// </summary>
        /// <returns>
        /// Tre or false to indication operations successful or not.
        /// </returns>
        public void LoadPage()
        {
            MyLittleRequest mlr = mlr_thispage;

            mlr.cookie_jar = cookie_pot.GetCookies(new Uri(base_url));
            HttpResponseMessage res = mlr.MakeGetRequestAsync().Result;

            state = "loaded";
            string content_str = res.Content.ReadAsStringAsync().Result;

            content_raw_string   = content_str;
            doc_css              = new CQ(content_str);
            response_headers     = res.Headers;
            this.request_headers = mlr.client.DefaultRequestHeaders;

            //store the bloody cookies;
            this.cookie_pot.Add
            (
                mlr.client_handler.CookieContainer.GetCookies(new Uri(this.base_url))
            );

            //refresh base url
        }