public static void PostData(string localFile) { var targetUrl = @"http://www.zip-codes.com/zip-code-radius-finder.asp"; var parameters = "zipMilesLow=0&zipMilesHigh=50&zip1=30303"; //--- Build the request object --- var request = System.Net.WebRequest.Create(targetUrl); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = parameters.Length; //--- Add the parameters to the request --- var sw = new System.IO.StreamWriter(request.GetRequestStream()); sw.Write(parameters); sw.Close(); //--- Get the response object --- var response = request.GetResponse(); var sr = new System.IO.StreamReader(response.GetResponseStream()); System.IO.File.WriteAllText(localFile, sr.ReadToEnd()); }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.