List<string> result = new List<string>();
// used to build entire input
StringBuilder sb = new StringBuilder();
// used on each read operation
byte[] buf = new byte[8192];
try
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
HttpWebResponse response =(HttpWebResponse) request.GetResponse();
Stream resStream = response.GetResponseStream();
string tempString = null;
int count = 0;
do
{
// fill the buffer with data
count = resStream.Read(buf, 0, buf.Length);
// make sure we read some data
if (count != 0)
{
// translate from bytes to ASCII text
tempString = Encoding.ASCII.GetString(buf, 0, count);
// continue building the string
sb.Append(HttpUtility.HtmlDecode( tempString));
}
}
while (count > 0); // any more data to read?
lblReeult.Text =(sb.ToString());
var mc = Regex.Matches(sb.ToString(),"([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})");
foreach (var c in mc)
{
result.Add(c.ToString());
}
}
catch (Exception ex)
{
throw ex;
}
return result;
No comments:
Post a Comment