服务端获取内容

string iosUrl = "https://itunes.apple.com/cn/app/yi-hao-huo-che-tong-cheng/id946723843?mt=8";
string androidUrl = "http://www.yihaohuoche.com/download/";
string responseHtml = string.Empty;
if (DeviceType.IOS == type)
{
HttpWebRequest downloadRequest = (HttpWebRequest)WebRequest.Create(iosUrl);

HttpWebResponse downloadResponse = (HttpWebResponse)downloadRequest.GetResponse();
//从Internet资源返回数据流
Stream downloadStream = downloadResponse.GetResponseStream();
//读取数据流
StreamReader downloadStreamReader = new StreamReader(downloadStream, System.Text.Encoding.Default);
//读取数据
responseHtml = downloadStreamReader.ReadToEnd();
downloadStreamReader.Close();
downloadStream.Close();
downloadResponse.Close();

}

你可能感兴趣的:(服务端获取内容)