日期:2014-05-20 浏览次数:21637 次
StreamReader sr = null;
HttpWebResponse response = null;
HttpWebRequest request = null;
Encoding encoding = System.Text.Encoding.GetEncoding("UTF-8");
CookieContainer cookieContainer = new CookieContainer();
Stream outstream = null;
Stream instream = null;
string content;
string roll = "http://tc.hd.xiaomi.com/hdget?callback=hdcontrol";
request = WebRequest.Create(roll) as HttpWebRequest;
request.CookieContainer = cookieContainer;
request.Method = "GET";
request.Host = "tc.hd.xiaomi.com";
request.UserAgent = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.11 Safari/537.36";
response = (HttpWebResponse)request.GetResponse();
instream = response.GetResponseStream();
sr = new StreamReader(instream, encoding);
content = sr.ReadToEnd();
Uri urroll = new Uri(roll);
if ((cookieContainer.GetCookieHeader(urroll).IndexOf("roll_t_hd_thda") < 0 ))
{
MessageBox.Show("没取到!");
}