C# codestatic string RegularFlowURL = "localhost/test.php";
public static void Check()
{
try
{
System.Net.ServicePointManager.Expect100Continue = false;
Stream instream = null;
StreamReader sr = null;
HttpWebResponse response = null;
HttpWebRequest request = null;
Encoding encoding = Encoding.UTF8;
request = WebRequest.Create(RegularFlowURL) as HttpWebRequest;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = 0;
response = request.GetResponse() as HttpWebResponse;
instream = response.GetResponseStream();
sr = new StreamReader(instream, encoding);
string content = sr.ReadToEnd();
}
catch (Exception ee)
{
MessageBox.Show("访问出错,请稍后再试");
}
}