Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.linq;using system.text;using system.threading.tasks;using system.windows.forms;using System.IO;using system.net;using system.text.regularexpressions;namespace windowsformsapplication1{public partial class Form1:form {public Form1 () {InitializeComponent (); The public string getwebcontent (string url, Encoding encode)//encode encoding {URL = textbiaoti. Text.trim (); Need to get the source code of the webpage WebRequest request = webrequest.create (URL); WebRequest.Create method, returns the WebRequest subclass HttpWebRequest WebResponse response = Request. GetResponse (); The Webrequest.getresponse method returns the response to the Internet request Stream Resstream = response. GetResponseStream (); The WebResponse.GetResponseStream method returns a data stream from an Internet resource. Encoding enc = encoding.getencoding ("Utf-8"); If it is garbled, change to Utf-8/GB2312 StReamreader sr = new StreamReader (Resstream, ENC); Namespace: System.IO. The StreamReader class implements a TextReader (TextReader class that represents a reader that can read a series of sequential characters) so that it reads characters from a byte stream in a specific encoding. Contenthtml.text = Sr. ReadToEnd (); Output (HTML code), TextBox control contenthtml to multiline mode return contenthtml.text; private void Button1_Click (object sender, EventArgs e) {try {string x = Getwebcontent (Textbiaoti. Text, Encoding.UTF8); Contenthtml.text = ""; Regex r = new Regex (@ "/^\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$/");//Regular System.Text.RegularExpressions.MatchCollection MC = r.matches (x);//means the regular expression pattern is applied iteratively to the input character The collection of successful matches found by the string. The System.Text.RegularExpressions Reference namespace (x) is the string to search for matches//The collection is immutable (read-only), and there is no public constructor. The Regex.Matches method returns the MatchCollection object. The collection contains 0 or more System.Text.RegularExpressions.Match objects. If the match succeeds, a System.Text.RegularExpressions.Ma corresponding to each match found in the input string is used.The Tch object to compute the collection. If the match is unsuccessful, the collection does not contain the System.Text.RegularExpressions.Match object, and its Count property equals 0. for (int i = 0; I < MC. Count; i++) {if (MC. Count = = 0) {Contenthtml.text = "No information is queried for the email address. "; } else {contenthtml.text + = Mc[i]. Value + "\ r \ n"; }}} catch (Exception ex) {MessageBox.Show ("Get Site Information error:" + Ex. Message); }} private void Button2_Click (object sender, EventArgs e) {string x = Getweb Content (Textbiaoti. Text, Encoding.UTF8); int a = X.indexof ("
Crawl Mailboxes and resources