Domain Search

xiaoxiao2021-03-06  65

///

/// "China Wan Net (

Www.net.cn) "Implement Domain Name Query

///

/// Domain Name

/// suffix (CN | COM | NET | NAME | ORG | COMCN | NETCN | ORGCN | GOVCN | INFO | BIZ | TV | CC)

/// The above is represented by: .cn | .com | .net | .name | .org | .com.cn | .net.cn |. Info | .biz | .tv | .cc

///

Public Static String Whois (String Domain, String EXT)

{

#Region This part may change, depending on whether China Wanwang is changing the query method and the content of the web page that shows the results of the query.

Const string cnturlb = "http://panda.www.net.cn/cgi-bin/check.cgi?gin=";//HTTP request head

Const string cnturlm = "& ext ="; // HTTP requests the intermediate portion (variable)

Const string cntmark = ""; // required "China Wanwang" return information start feature

Const string cnttableb = ""; // "China Wanwang" returns the feature of a Table in the information

// The three cases of "China Wanwang" query results are known

Const string cntqn = "This domain is not registered";

Const string cntreg = "The domain name has been registered";

Const string cntNotReg = "Unregistered Domain Name";

#ndregion

#Region This part of this part

// The following is used to replace "China Wan Net" return information in Table style

Const string cnttabler = " ";

Const string cnttablee = " ";

Const string cnttable = "

";

/ / Customize the result of the query, used for page display

Const string cntable = "Congratulations, this is a";

Const string cntnotconnect = "Cannot connect to the server, please try again!";

#ndregion

String strresult = string.empty;

Try

{

#Region here execution query

/ / Query domain name from "China Wanwang"

Strince = CNTURLB DOMAIN CNTURLM EXT; // Establishing a request

WebRequest WremeSt = WebRequest.create (Strurl);

// Wremest.Proxy = New WebProxy ("Server", 8080); // Vision settings

Wremest.timeout = 30000;

WebResponse WRESPONSE = WREQUEST.GETRESPONSE (); // Execute Request

Street response.getReam = WRESPONSE.GETRESPONSESTREAM (); // Read Multi-Network Return Result

StreamReader Reader = New StreamReader (responsestream, Encoding.default);

String responsehtml = reader.readToend (); // Save all results to strings

WRESPONSE.CLOSE ();

#ndregion

/ / Take out the result of the query

Strresult = responsehtml.substring (responsehtml.indexof (cntmark), responsehtml.indexof (cnttableb) - Responsehtml.indexof (cntmark);

#Region This part of this part

/ / Adjust results as needed

Strresult = CNTTABLE STRRESULT CNTTABLER;

IF (Responsehtml.indexof (CNTQN)> -1)

{

Strresult = CNTQN "!" CNTTABLEE;

}

Else IF (Responsehtml.indexof (cntreg)> -1)

{

Strresult = CNTREG "!" CNTTABLEE;

}

Else IF (Responsehtml.indexof (CNTNotReg)> -1)

{

Strresult = Cntable CNTNotReg "!" CNTTABLEE;

}

Else

{

Strresult = responsehtml;

}

#ndregion

}

Catch (WebException)

{

Strresult = cntnotconnect "/ n";

}

Catch (Uriformatexception ERR)

{

Strresult = err.message;

}

Return Strresult;

}

转载请注明原文地址:https://www.9cbs.com/read-89756.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.036, SQL: 9