Beispiel #1
0
        private String GetHtmlString(String url)
        {
            try {
                HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                StreamReader    reader   = new StreamReader(response.GetResponseStream(), Encoding.Default);
                String          strHtml  = reader.ReadToEnd();

                //strHtml = Regex.Replace(strHtml, @"<(.|\n)*?>", String.Empty);
                strHtml = Regex.Replace(strHtml, @"<(.|\n)*?>", String.Empty);
                strHtml = strHtml.Replace(" ", "").Replace("\t", "").Replace("//-->", "");
                String[] str = strHtml.Split(new Char[] { '\n' });
                strHtml = null;
                foreach (String s in str)
                {
                    if (s.Trim() != "")
                    {
                        strHtml += s + ":";
                    }
                }

                reader.Close();
                response.Close();

                return(strHtml);
            }
            catch (Exception exception)
            {
                CoreEngine.GetInstance().SendLogErrorMessage(exception.Message);
                return(string.Empty);
            }
        }
Beispiel #2
0
        public static CoreEngine GetInstance()
        {
            if (coreInstance == null)
            {
                coreInstance = new CoreEngine();
            }

            return(coreInstance);
        }