|
楼主 |
发表于 2015-7-1 21:50:53
|
显示全部楼层
string Url = "http://dd.search.jd.com/?ver=2&zip=1&key=%E9%AD%85%E8%93%9Dnote2";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
request.Method = "GET";
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0";
request.Accept = "*/*";
request.ContentType = "text/json;charset=UTF-8";
request.Timeout = 10000;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream myResponseStream = response.GetResponseStream();
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
textBox.Text = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close(); |
|