在c#用httpwebrequest中发送get/http/https请求后,怎么获得数据
2个回答
展开全部
public string Get(string url)
{
HttpWebRequest request;
// 创建一个HTTP请求
request = (HttpWebRequest)WebRequest.Create(url);
//request.Method="get";
HttpWebResponse response;
response = (HttpWebResponse)request.GetResponse();
System.IO.StreamReader myreader = new System.IO.StreamReader(response.GetResponseStream(), Encoding.Unicode);
string responseText = myreader.ReadToEnd();
myreader.Close();
return responseText;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询