Re: [問題] 請問使用POST的問題
<吃光光></吃光光>
雖然還是不曉得前面的方式錯誤在哪,不過已經找到解決方法了
string SearchPage = @"http://www.ticket.com.tw/search.asp";
string UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3";
NameValueCollection postArguments = new NameValueCollection();
postArguments.Add("KeyWord", "");
postArguments.Add("TypeRead", HttpUtility.HtmlEncode("0,所有藝文(不含電影,
套票)"));
postArguments.Add("SelArea", HttpUtility.HtmlEncode("0,不限地區"));
postArguments.Add("SelYear", "0");
postArguments.Add("SelMonth", "0");
postArguments.Add("SelDate", "0");
postArguments.Add("SqlServerName", "192.168.100.200");
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.UserAgent] = UserAgent;
webClient.Encoding = Encoding.GetEncoding("big5");
byte[] bytes = webClient.UploadValues(SearchPage, postArguments);
string result = Encoding.GetEncoding("big5").GetString(bytes);
最後的result就是該頁的資訊了 ^^
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 124.10.5.203
推
04/09 15:41, , 1F
04/09 15:41, 1F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):