[Original] verify whether the proxy IP is useful, the original proxy ip
/// <Summary> /// verify whether the proxy IP address is useful /// </summary> /// <param name = "ip"> IP address </param> /// <param name = "port"> port number </param> // <returns> returns true </returns> static bool IsEnabled (string ip, int port) {try {HttpWebRequest Req = (HttpWebRequest) WebRequest. create (" http://www.whatismyip.com.tw/ "); WebProxy proxyObject = new WebProxy (ip, port); // ip address, port number Req. proxy = proxyObject; // sets Proxy Req. userAgent = "Mozilla/5.0 (Windows NT 6.1; rv: 31.0) Gecko/20100101 Firefox/31.0"; HttpWebResponse Resp = (HttpWebResponse) Req. getResponse (); Encoding code = Encoding. getEncoding ("UTF-8"); using (StreamReader sr = new StreamReader (Resp. getResponseStream (), code) {if (sr! = Null) {string strHtml = sr. ReadToEnd (); MatchCollection mc = Regex. Matches (strHtml, "
How to verify whether the proxy IP address is valid
Open IE. Enter www.ip138.com to display your Internet IP address ..
Proxy IP Verification
One by one.