110,502
社区成员
发帖
与我相关
我的任务
分享
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.url);
request.Timeout = 150000;
request.Headers.Set("Pragma", "no-cache");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream streamReceive = response.GetResponseStream();
Encoding encoding = Encoding.GetEncoding("GB2312");
StreamReader streamReader = new StreamReader(streamReceive, encoding);
strResult = streamReader.ReadToEnd();
streamReceive.Close();
streamReader.Close();
private string MopInfo()
{
string str = "";
string url = "http://dzh.mop.com/leftListData.do?page=0&rowNum=100&order=lastReply&mainplate=0";
string html = "";
Uri uri = new Uri(url);
try
{
HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
req.Timeout = 30000;
HttpWebResponse res = req.GetResponse() as HttpWebResponse;
StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8);
html = sr.ReadToEnd();//网页源代码
sr.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "请重试!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
return str;
}