7,777
社区成员
发帖
与我相关
我的任务
分享
Stream stream = null;
HttpWebResponse response = null;
HttpWebRequest request = null;
request = WebRequest.Create(string.Format("http://xx.New") as HttpWebRequest;
string strPostData = "name=游客&SEX=0";
byte[] wrBuffer = Encoding.GetEncoding("gb2312").GetBytes(string.Format(strPostData));
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = wrBuffer.Length;
// request.Referer = string.Format("http://xx.cn/");
request.UserAgent = "MSIE 6.0";
request.Timeout = 8000;
////设置一个代理
//System.Net.WebProxy myproxy = new System.Net.WebProxy("218.63.252.219", 80);
//request.Proxy = myproxy;
stream = request.GetRequestStream();
stream.Write(wrBuffer, 0, wrBuffer.Length);
stream.Close();
response = request.GetResponse() as HttpWebResponse;
stream = response.GetResponseStream();
StreamReader sr = null;
sr = new StreamReader(stream, big5);
sr.Close();
stream.Close();