程序post - 烈马狂生 - 博客园
烈马狂生
·
2008-12-08
·
via 博客园 - 烈马狂生
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "srh_type=0";
postData += "&cityid=0101";
postData += "&price=-1";
postData += "&star=-1";
postData
+= "&__EVENTTARGET=Search1$Pager";
postData += "&__EVENTARGUMENT=1";byte[] data = encoding.GetBytes(postData);// Prepare web request
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://**");
myRequest.Method
= "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();// Get response
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default);
string content = reader.ReadToEnd();
Response.Write(content);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。