c# 获取网络接口数据 单纯从地址获取
try
{
//URL 为网络接口地址
HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(URL);
HttpWebResponse httpResp = (HttpResponse)httpReq.GetResponse();
StreamReader sr = new StreamReader(httpResp.GetResponseStream(),Encoding.UTF8);
//获取返回的数据
string responseString = sr.ReadToEnd();
sr.Close();
httpResp.Close();
}
catch(Exception ex)
{
//MessageBox.show(ex.Message);
}