HttpWebRequest myWebRequest = (HttpWebRequest)WebRequest.Create("http://www.ncedc.org/cgi-bin/catalog-search2.pl"); // Obtain the 'Proxy' of the Default browser. IWebProxy proxy = myWebRequest.Proxy; // Print the Proxy Url to the console. if (proxy != null) { Console.WriteLine("Proxy: {0}", proxy.GetProxy(myWebRequest.RequestUri)); } else { Console.WriteLine("Proxy is null; no proxy will be used"); } WebClient client = new System.Net.WebClient(); NameValueCollection postData = new NameValueCollection(); postData.Add("format", "ncread"); postData.Add("mintime", "2013/08/03,00:00:00"); postData.Add("minmag", "1.0"); postData.Add("etype", "E"); postData.Add("outputloc", "web"); postData.Add("searchlimit", "200000"); client.Proxy = new WebProxy("10.10.10.1",8080); byte[] data = client.UploadValues("http://www.ncedc.org/cgi-bin/catalog-search2.pl", "POST", postData); string html = System.Text.Encoding.UTF8.GetString(data); if (File.Exists("C:\\Windows\\Temp\\text.html")) { File.Delete("C:\\Windows\\Temp\\text.html"); } File.WriteAllText("C:\\Windows\\Temp\\text.html", html); Console.ReadKey(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)