111,129
社区成员
发帖
与我相关
我的任务
分享
string url = "http://w.qzone.qq.com/cgi-bin/likes/internal_dolike_app?g_tk=" + _key;
HttpWebRequest requst = WebRequest.Create(url) as HttpWebRequest;
requst.Method = "POST";
requst.Host = "w.qzone.qq.com";
requst.AutomaticDecompression = DecompressionMethods.GZip;
requst.KeepAlive = true;
requst.Headers[HttpRequestHeader.AcceptLanguage] = "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3";
requst.Headers[HttpRequestHeader.AcceptEncoding] = "gzip, deflate";
requst.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0";
requst.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
requst.ContentType = "application/x-www-form-urlencoded";
//参数设置
string shuoshuoid = "46c54c5998411257d4040200";
byte[] btbyte = Encoding.UTF8.GetBytes("qzreferrer=http%3A%2F%2Fuser.qzone.qq.com%2F" + _qq_fuwu + "%2F"
+ "&opuin=" + _qq_fuwu
+ "&unikey=http:%3A%2F%2Fuser.qzone.qq.com%2F" + _qq_kehu + "%2Fmood%2F" + shuoshuoid
+ "&curkey=http:%3A%2F%2Fuser.qzone.qq.com%2F" + _qq_kehu + "%2Fmood%2F" + shuoshuoid
+ "&from=1"
+ "&appid=311"
+ "&typeid=0"
+ "&abstime=1460869123"
+ "&fid=" + shuoshuoid
+ "&active=0"
+ "&fupdate=1");
requst.ContentLength = btbyte.Length;
//获取流
//*****************主要问题出在这里,获取参数流时停顿了下,然后用封包拦截器,看了下在这里他就已经上传封包了*******
Stream s = requst.GetRequestStream();
s.Write(btbyte, 0, btbyte.Length);
s.Close();
try
{
HttpWebResponse se = requst.GetResponse() as HttpWebResponse;//然后这一句就没有任何停顿的执行过去了
StreamReader streamReader;
string responseContent;
streamReader = new StreamReader(se.GetResponseStream(), Encoding.UTF8);
responseContent = streamReader.ReadToEnd();
Encoding.UTF8.GetString(Encoding.Default.GetBytes(responseContent));
}
catch (Exception)
{
}